A large time series of line plots or images using Matplotlib is shared most easily as a movie file.
Example of Matplotlib movie write
In example matplotlib_writeavi.py, just four added lines of code do the AVI writing.
- first line tells Matplotlib to use FFMPEG already installed on most Linux systems, and easily installed on Windows and Mac
brew install ffmpeg
- second line tells Matplotlib to make a lossless FFV1 video at 15 frames/sec. (you can optionally use
mpeg4lossy, but I think you should use lossless to help avoid washing out details of plots).
third line says to use 100 DPI (smaller DPI–smaller file and movie size)
#!/usr/bin/env python import matplotlib.animation as anim ... Writer = anim.writers['ffmpeg'] writer = Writer(fps=15, codec='ffv1') ... with writer.saving(fg, fn,100): ... writer.grab_frame(facecolor='k')
Minimum AVI frame rate
Note that using less than 3 fps can invoke bugs on VLC. VLC has trouble with slow frame rate video from any source