animation_test, a Python code which demonstrates techniques for displaying an animation, that is, a sequence of still images which are automatically displayed at regular intervals, without requiring the user to hit RETURN for the next image.
Personally, I find the recommended methods of animation to be awkward and obscurely documented. You must either simply copy a working example, or learn to be comfortable with explanations that employ words like 'iterable' and 'artist'.
One alternative is simply to create a series of static images, save each one to a file using the matplotlib() savefig() function, carefully giving each file a consecutive name, and then call on ImageMagick convert() to turn them into a movie. It is reasonable to assume that you know enough matplotlib() to make still images, so the only additional cost is looking up how the convert() function works.
matplotlib provides a procedure FuncAnimation() for creating animations. However, this procedure has limited documentation, and a peculiarly constrained user interface. The user provides a ``frame(i)'' function whose only input is the frame counter i, which must return, in a somewhat obscure fashion, the raw plot elements involved in the frame.
While it's not too hard to use this facility to create an animation of a sine curve, it's more difficult to see how to, for instance, compute a sequence of solutions to a partial differential equation, and display the sequence of time solutions in a movie file. One difficulty is that this calculation requires the frame function to have access to the data at the previous time step, which can't be done through the parameter list, and which isn't easily done simply by declaring the data in the user's main program.
The information on this web page is distributed under the MIT license.
animation_test is available in a MATLAB version and an Octave version and a Python version.
allen_cahn_pde, a Python code which sets up and solves the 1D Allen-Cahn reaction-diffusion partial differential equation (PDE).
graphics_test, a Python code which illustrates how various kinds of data can be displayed and analyzed graphically.
movie_test, a Python code which creates a movie file from a sequence of solutions to a partial differential equation, using matplotlib().
convert -delay 10 -loop 1 arenstorf*.png arenstorf_animation.gifwhich is actually invoked inside the Python script.
convert -delay 10 -loop 1 *.png cos_animation.gifwhich is actually invoked inside the Python script.