.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/path_effects/demo_smoothed_path_simple.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_examples_path_effects_demo_smoothed_path_simple.py: ==================== Simple Smooth path ==================== Adopted from seaborn's timeseries_facets example .. GENERATED FROM PYTHON SOURCE LINES 8-43 .. image-sg:: /examples/path_effects/images/sphx_glr_demo_smoothed_path_simple_001.png :alt: Original, w/ Smooth :srcset: /examples/path_effects/images/sphx_glr_demo_smoothed_path_simple_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="dark") flights = sns.load_dataset("flights") fig, axs = plt.subplots(1, 2, figsize=(8, 4)) def myplot(ax): sns.lineplot( data=flights, x="month", y="passengers", units="year", hue="year", estimator=None, ax=ax ) ax.set_xticks(ax.get_xticks()[::2]) # Original plot axs[0].set_title("Original") myplot(axs[0]) # Same plot, but We apply Smooth patheffects to make the lines smooth. axs[1].set_title("w/ Smooth") myplot(axs[1]) from mpl_visual_context.patheffects import Smooth pe_smooth = Smooth() for l in axs[1].lines: l.set_path_effects([pe_smooth]) fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.556 seconds) .. _sphx_glr_download_examples_path_effects_demo_smoothed_path_simple.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_smoothed_path_simple.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_smoothed_path_simple.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_smoothed_path_simple.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_