.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "matplotlib/plot_line_with_edge.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_matplotlib_plot_line_with_edge.py: plot_line_with_edge.py ========================= .. GENERATED FROM PYTHON SOURCE LINES 6-31 .. image-sg:: /matplotlib/images/sphx_glr_plot_line_with_edge_001.png :alt: plot line with edge :srcset: /matplotlib/images/sphx_glr_plot_line_with_edge_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt import matplotlib.patheffects as patheffects fig, ax = plt.subplots(1,2) ax[1].set_facecolor('k') x = np.linspace(0, 1.5, 1000) y = lambda alpha : x**(alpha) for alpha in np.linspace(0, 2, 10): lx, = ax[0].plot(x, y(alpha), lw=2) lx.set_path_effects([ patheffects.Stroke(linewidth=lx.get_linewidth()+1.5, foreground="w", alpha=1), patheffects.Normal() ]) lx, = ax[1].plot(x, y(alpha), lw=2) lx.set_path_effects([ patheffects.Stroke(linewidth=lx.get_linewidth()+1.5, foreground="w", alpha=1), patheffects.Normal() ]) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.670 seconds) .. _sphx_glr_download_matplotlib_plot_line_with_edge.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_line_with_edge.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_line_with_edge.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_line_with_edge.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_