O'Reilly logo

Python Data Visualization Cookbook by Igor Milovanović

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

Animation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required