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.
Animation writers - Python Tutorial
From the course: Python Data Visualization: Create Impactful Visuals, Animations, and Dashboards by Pearson
Animation writers
Lesson 5.3, Animation Writers. After we set up our FuncAnimation object, we have to call a writer to actually generate all the frames. To do this, there are several possible writer methods. In this lesson, we're going to be focusing on the three most common ones, and, in my opinion, the three most useful ones. The first one, and perhaps the most standard one, is SimpleAnimation.Save. This simply instructs Matplotlib to save the animation to disk as a file, and it detects or identifies what the file format should be based on the extension that you provide for the file name. A more robust and more generic way of doing this is to actually provide a FFmpeg writer instance and have that writer actually generate the video for you. FFmpegWriter is essentially a generic interface to generate video files which supports a wider range of video formats and options. So, in this simple example, these two little lines of Python code that we see here, we instantiate the FFmpegWriter instance, we're…