.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_rolling.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 or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_rolling.py: Rolling smoothing for multi-series ================================== .. GENERATED FROM PYTHON SOURCE LINES 5-25 .. code-block:: Python import numpy as np import pandas as pd import seaborn.objects as so import seaborn_objects_recipes as sor rng = np.random.default_rng(0) t = np.arange(200) df = pd.DataFrame({ "t": np.tile(t, 3), "y": np.r_[np.sin(t/15)+rng.normal(0,0.2,200), np.cos(t/18)+rng.normal(0,0.2,200), 0.5*np.sin(t/20)+rng.normal(0,0.2,200)], "series": np.repeat(["A","B","C"], 200) }) roll = sor.Rolling(window_type="gaussian", window_kwargs={"std": 3}) (so.Plot(df, x="t", y="y", color="series") .add(so.Lines(), so.Agg(), roll) .label(title="Rolling smoothing (gaussian, std=3)", x="t", y="y")) .. _sphx_glr_download_auto_examples_plot_rolling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/oosei25/seaborn_objects_recipes/main?filepath=docs/tutorial/auto_examples/plot_rolling.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_rolling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_rolling.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_rolling.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_