A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://matplotlib.org/stable/api/_as_gen/matplotlib.animation.AbstractMovieWriter.html below:

matplotlib.animation.AbstractMovieWriter — Matplotlib 3.10.5 documentation

matplotlib.animation.AbstractMovieWriter#
class matplotlib.animation.AbstractMovieWriter(fps=5, metadata=None, codec=None, bitrate=None)[source]#

Abstract base class for writing movies, providing a way to grab frames by calling grab_frame.

setup is called to start the process and finish is called afterwards. saving is provided as a context manager to facilitate this process as

with moviewriter.saving(fig, outfile='myfile.mp4', dpi=100):
    # Iterate over frames
    moviewriter.grab_frame(**savefig_kwargs)

The use of the context manager ensures that setup and finish are performed as necessary.

An instance of a concrete subclass of this class can be given as the writer argument of Animation.save().

__init__(fps=5, metadata=None, codec=None, bitrate=None)[source]#

Methods

Attributes

abstractmethod finish()[source]#

Finish any processing for writing the movie.

property frame_size#

A tuple (width, height) in pixels of a movie frame.

abstractmethod grab_frame(**savefig_kwargs)[source]#

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 call that saves the figure. However, several keyword arguments that are supported by savefig may not be passed as they are controlled by the MovieWriter:

  • dpi, bbox_inches: These may not be passed because each frame of the

    animation much be exactly the same size in pixels.

  • format: This is controlled by the MovieWriter.

saving(fig, outfile, dpi, *args, **kwargs)[source]#

Context manager to facilitate writing the movie file.

*args, **kw are any parameters that should be passed to setup.

abstractmethod setup(fig, outfile, dpi=None)[source]#

Setup for writing the movie file.

Parameters:
figFigure

The figure object that contains the information for frames.

outfilestr

The filename of the resulting movie file.

dpifloat, default: fig.dpi

The DPI (or resolution) for the file. This controls the size in pixels of the resulting movie file.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4