From the course: Python Data Visualization: Create Impactful Visuals, Animations, and Dashboards by Pearson
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Demo - Python Tutorial
From the course: Python Data Visualization: Create Impactful Visuals, Animations, and Dashboards by Pearson
Demo
Now that we have a good grasp of how the basics and not-so-basic functionality of matplotlib works, how to build fancy visualizations, maps, etc., we're going to see how we can add some animations to matplotlib and how to generate animations directly from matplotlib. This is perhaps one of the most obscure corners of Matplotlib, it's not as well-known as other parts of the library, but it's in my opinion fairly powerful and very simple to use. As usual, we import all the packages of the modules we're going to be using. In addition to the regular Matplotlib, we also have Matplotlib animation. And from MPL toolkits, we have mplot3d, which essentially gives us the ability to draw three-dimensional pictures using matplotlib. We're also going to be using cartopi as before. From watermark we see that our cartopi is 0.22, our matplotlib is 3.8.4. So we're going to start with the simplest possible example of an animation. So we generate a figure with a set of axes. We're setting, we're…