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 happens if we change the values of variables. Our main library has limited but usually sufficient animation capabilities and we will explain how to use them.

Getting ready

The framework for animation is added to standard matplotlib from version 1.1 and its main class is matplotlib.animation.Animation. This class is the base class, which is to be subclassed for specific behavior, as is the case with the classes already provided: TimedAnimation, ArtistAnimation, and FuncAnimation.

Class name (parent class)

Description

Animation (object)

This class wraps the creation of an animation ...

Get Python Data Visualization Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.