.. 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_closed.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_closed.py: ==================== Smooth demo, w/ closed path created by fill_between. ==================== Adopted from seaborn's errorband_lineplots example .. GENERATED FROM PYTHON SOURCE LINES 8-39 .. image-sg:: /examples/path_effects/images/sphx_glr_demo_smoothed_path_closed_001.png :alt: demo smoothed path closed :srcset: /examples/path_effects/images/sphx_glr_demo_smoothed_path_closed_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import numpy as np from scipy.interpolate import make_interp_spline import matplotlib.pyplot as plt # from mpl_visual_context.patheffects import Smooth, StrokeColor, GCModify from mpl_visual_context.patheffects import Smooth, SmoothFillBetween import seaborn as sns # sns.set_theme(style="darkgrid") # Load an example dataset with long-form data fmri = sns.load_dataset("fmri") fig, ax = plt.subplots(num=1, clear=True) # Plot the responses for different events and regions sns.lineplot(x="timepoint", y="signal", hue="region", style="event", data=fmri, ax=ax) # The code above creates 10 lines. ax.lines[4:] have no data. Not sure what # they are. for l in ax.lines[:4]: l.set_path_effects([Smooth()]) for col in ax.collections: col.set_path_effects([SmoothFillBetween(skip_first_n=1)]) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.315 seconds) .. _sphx_glr_download_examples_path_effects_demo_smoothed_path_closed.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_closed.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_smoothed_path_closed.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_smoothed_path_closed.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_