Bases: matplotlib.animation.FFMpegBase
Bases: matplotlib.animation.AVConvBase, matplotlib.animation.FFMpegFileWriter
Bases: matplotlib.animation.AVConvBase, matplotlib.animation.FFMpegWriter
Construct a new MovieWriter object.
Bases: object
This class wraps the creation of an animation using matplotlib. It is only a base class which should be subclassed to provide needed behavior.
fig is the figure object that is used to get draw, resize, and any other needed events.
event_source is a class that can run a callback when desired events are generated, as well as be stopped and started. Examples include timers (see TimedAnimation) and file system notifications.
blit is a boolean that controls whether blitting is used to optimize drawing.
Creates a new sequence of frame information.
Creates a new sequence of saved/cached frame information.
Saves a movie file by drawing every frame.
filename is the output filename, e.g., mymovie.mp4
writer is either an instance of MovieWriter or a string key that identifies a class to use, such as ‘ffmpeg’ or ‘mencoder’. If nothing is passed, the value of the rcparam animation.writer is used.
fps is the frames per second in the movie. Defaults to None, which will use the animation’s specified interval to set the frames per second.
dpi controls the dots per inch for the movie frames. This combined with the figure’s size in inches controls the size of the movie.
codec is the video codec to be used. Not all codecs are supported by a given MovieWriter. If none is given, this defaults to the value specified by the rcparam animation.codec.
bitrate specifies the amount of bits used per second in the compressed movie, in kilobits per second. A higher number means a higher quality movie, but at the cost of increased file size. If no value is given, this defaults to the value given by the rcparam animation.bitrate.
extra_args is a list of extra string arguments to be passed to the underlying movie utiltiy. The default is None, which passes the additional argurments in the ‘animation.extra_args’ rcParam.
metadata is a dictionary of keys and values for metadata to include in the output file. Some keys that may be of use include: title, artist, genre, subject, copyright, srcform, comment.
extra_anim is a list of additional Animation objects that should be included in the saved movie file. These need to be from the same matplotlib.Figure instance. Also, animation frames will just be simply combined, so there should be a 1:1 correspondence between the frames from the different animations.
savefig_kwargs is a dictionary containing keyword arguments to be passed on to the ‘savefig’ command which is called repeatedly to save the individual frames. This can be used to set tight bounding boxes, for example.
Bases: matplotlib.animation.TimedAnimation
Before calling this function, all plotting should have taken place and the relevant artists saved.
frame_info is a list, with each list entry a collection of artists that represent what needs to be enabled on each frame. These will be disabled for other frames.
Bases: object
Bases: matplotlib.animation.FileMovieWriter, matplotlib.animation.FFMpegBase
Bases: matplotlib.animation.MovieWriter, matplotlib.animation.FFMpegBase
Construct a new MovieWriter object.
Bases: matplotlib.animation.MovieWriter
MovieWriter subclass that handles writing to a file.
Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
Grab the image information from the figure and save as a movie frame. All keyword arguments in savefig_kwargs are passed on to the ‘savefig’ command that saves the figure.
Perform setup for writing the movie file.
Bases: matplotlib.animation.TimedAnimation
Makes an animation by repeatedly calling a function func, passing in (optional) arguments in fargs.
frames can be a generator, an iterable, or a number of frames.
init_func is a function used to draw a clear frame. If not given, the results of drawing from the first item in the frames sequence will be used. This function will be called once before the first frame.
If blit=True, func and init_func should return an iterable of drawables to clear.
kwargs include repeat, repeat_delay, and interval: interval draws a new frame every interval milliseconds. repeat controls whether the animation should repeat when the sequence of frames is completed. repeat_delay optionally adds a delay in milliseconds before repeating the animation.
Bases: object
Bases: matplotlib.animation.FileMovieWriter, matplotlib.animation.ImageMagickBase
Bases: matplotlib.animation.MovieWriter, matplotlib.animation.ImageMagickBase
Construct a new MovieWriter object.
Bases: object
Bases: matplotlib.animation.FileMovieWriter, matplotlib.animation.MencoderBase
Bases: matplotlib.animation.MovieWriter, matplotlib.animation.MencoderBase
Construct a new MovieWriter object.
Bases: object
Base class for writing movies. Fundamentally, what a MovieWriter does is provide is a way to grab frames by calling grab_frame(). setup() is called to start the process and finish() is called afterwards. This class is set up to provide for writing movie frame data to a pipe. saving() is provided as a context manager to facilitate this process as:
with moviewriter.saving('myfile.mp4'):
# Iterate over frames
moviewriter.grab_frame()
The use of the context manager ensures that setup and cleanup are performed as necessary.
Construct a new MovieWriter object.
Returns the binary path to the commandline tool used by a specific subclass. This is a class method so that the tool can be looked for before making a particular MovieWriter subclass available.
Clean-up and collect the process used to write the movie file.
Finish any processing for writing the movie.
A tuple (width,height) in pixels of a movie frame.
Grab the image information from the figure and save as a movie frame. All keyword arguments in savefig_kwargs are passed on to the ‘savefig’ command that saves the figure.
Check to see if a MovieWriter subclass is actually available by running the commandline tool.
Context manager to facilitate writing the movie file.
*args are any parameters that should be passed to setup.
Perform setup for writing the movie file.
Bases: object
Get a list of available MovieWriters.
Bases: matplotlib.animation.Animation
Animation subclass that supports time-based animation, drawing a new frame every interval milliseconds.
repeat controls whether the animation should repeat when the sequence of frames is completed.
repeat_delay optionally adds a delay in milliseconds before repeating the animation.