.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_01_simple_animation.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_gallery_plot_01_simple_animation.py: .. _small_reference: Simple animation ################ explain the utilisation of the ``plot`` function .. GENERATED FROM PYTHON SOURCE LINES 10-44 .. video:: /home/docs/checkouts/readthedocs.org/user_builds/animation-maker/checkouts/latest/doc/source/gallery/images/sphx_glr_plot_01_simple_animation_001.mp4 :autoplay: :loop: .. code-block:: Python import matplotlib.pyplot as plt import numpy as np ANIM_FPS = 6 ANIM_OUTPUT_FOLDER = "animation/example_01" ANIM_MAX_FRAMES = ANIM_FPS * 7 def plot(i, ds): """ Parameters ---------- i: int indice of the image. ds: xarray.Dataset data passed to the plotting function Returns ------- fig: matplotlib.figure.Figure the figure to save """ fig, ax = plt.subplots(1, 1, figsize=(4, 4), dpi=120) ax.set_xlim(-1, 1) ax.set_ylim(-1, 1) n = i + 7 # starts indices at 7 x = np.arange(n + 1) / n * 2 * np.pi ax.plot(np.sin(x), np.cos(x)) ax.set_title(f"image {i} : n={n}") return fig .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.399 seconds) .. _sphx_glr_download_gallery_plot_01_simple_animation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_simple_animation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_simple_animation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_simple_animation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_