| [ Web Proxy ] |
| Viewing: https://matplotlib.org/devdocs/api/toolkits/../_as_gen/../../gallery/animation/animation_demo.html | [Back] [Original] |
Section Navigation
fill_between with transparencyhisttype settingsplt.subplotsfloating_axes featuresNote
Go to the end to download the full example code.
Generating an animation by calling pause between plotting commands.
The method shown here is only suitable for simple, low-performance use. For
more demanding applications, look at the animation module and the
examples that use it.
Note that calling time.sleep instead of pause would not work.
Output generated via matplotlib.animation.Animation.to_jshtml.
[frame 49]import matplotlib.pyplot as plt
import numpy as np
np.random.seed(19680801)
data = np.random.random((50, 50, 50))
fig, ax = plt.subplots()
for i, img in enumerate(data):
ax.clear()
ax.imshow(img)
ax.set_title(f"frame {i}")
# Note that using time.sleep does *not* work here!
plt.pause(0.1)
Total running time of the script: (0 minutes 8.447 seconds)
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.1.
Built from v3.11.2-856-gf318e2855.
Built with the PyData Sphinx Theme 0.18.0.
| Web Proxy Viewer | New URL | Original Page |