Animating in matplotlib
In this recipe, we will explore how to animate our figures. Sometimes it is more descriptive to have pictures moving in animations to explain what is going on when we change values of variables. Our main library has limited but usually sufficient animation capabilities and we will explain how to use them.
Getting ready
A framework for animation is added to the standard matplotlib from version 1.1 and its main class is matplotlib.animation.Animation
. This class is a base class; it is to be subclassed for specific behavior as is the case with the already provided classes: TimedAnimation
, ArtistAnimation
, and FuncAnimation
. The following table gives the description of the classes:
Class name (parent class) |
Description |
---|---|
|
This class wraps the creation of an animation using matplotlib. It is only a base class that should be subclassed to provide the needed behavior. |
|
This animation subclass supports time-based animation... |