Last updated
Last updated
Exploring datasets is a big part of what many scientists do these days. In many cases, these datasets will have more than two dimensions. For example, temperature or salinity in an ocean circulation model has four dimensions: x, y, z, t.
It’s futile to try and display these in a single plot. That’s where animation can help.
Matplotlib’s animation
deals with the animation part. It provides a framework around which the animation functionality is built. There are two main interfaces to achieve that using:
Let's draw a 3D tulip this time.
: makes an animation by repeatedly calling a function func
. It is the most convenient one to use.
: Animation using a fixed set of Artist
objects.
We can use to simplify the process of creating animations in matplotlib. It creates a figure and creates a camera
. Then it reuses figure and after each frame is created, take a snapshot with the camera. Finally, an animation is created with all the captured frames.