.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_10_moving_earth.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_10_moving_earth.py: Make the earth go round ####################### Small example showing how to make the earth moving .. GENERATED FROM PYTHON SOURCE LINES 8-41 .. video:: /home/docs/checkouts/readthedocs.org/user_builds/animation-maker/checkouts/latest/doc/source/gallery/images/sphx_glr_plot_10_moving_earth_001.mp4 :autoplay: :loop: .. code-block:: Python import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt ANIM_FPS = 60 ANIM_OUTPUT_FOLDER = "animation/example_10" ANIM_MAX_FRAMES = ANIM_FPS * 10 def plot(i_image, *args): """créée une figure""" # à chaque image, on augmente la longitude dlon = (i_image / ANIM_FPS) * 36 center_lon = dlon % 360 center_lat = 0 fig = plt.figure(figsize=(4, 4), dpi=90) proj2 = ccrs.Orthographic(central_latitude=center_lat, central_longitude=center_lon % 360) ax = fig.add_subplot(1, 1, 1, projection=proj2) ax.coastlines() ax.add_feature(cfeature.LAND) ax.add_feature(cfeature.OCEAN) ax.set_global() ax.set_title(f"frame={i_image:03d}, camera_lon={center_lon:7.2f}, camera_lat={center_lat:7.2f}") return fig .. rst-class:: sphx-glr-timing **Total running time of the script:** (8 minutes 9.423 seconds) .. _sphx_glr_download_gallery_plot_10_moving_earth.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_10_moving_earth.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_10_moving_earth.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_10_moving_earth.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_