Creating animated plots
As explained at the start of this chapter, Matplotlib was not originally designed for making animations, and there are GPU-accelerated Python animation packages that may be more suitable for such a task (such as PyGame). However, since we are already familiar with Matplotlib, it is quite easy to adapt existing plots to animations.
Installation of FFmpeg
Before we start making animations, we need to install either FFmpeg, avconv, MEncoder, or ImageMagick on our system. These additional dependencies are not bundled with Matplotlib, and so we need to install them separately. We are going to walk you through the steps of installing FFmpeg.
For Debian-based Linux users, FFmpeg can be installed by issuing the following command in the terminal:
sudo apt-get install ffmpeg
Note
FFmpeg may not be available on Ubuntu 14.04 or earlier. To install FFmpeg on Ubuntu 14.04, please follow the steps below:Â
Â
sudo add-apt-repository ppa:mc3man/trusty-media
Press Enter to confirm the addition...