matplotlib._api.deprecation.rename_parameter(since, old, new, func=None)[source]

Decorator indicating that parameter old of func is renamed to new. The actual implementation of func should use new, not old. If old is passed to func, a DeprecationWarning is emitted, and its value is used, even if new is also passed by keyword (this is to simplify pyplot wrapper functions, which always pass new explicitly to the Axes method). If new is also passed but positionally, a TypeError will be raised by the underlying function during argument binding. Examples @_api.rename_parameter("3.1", "bad_name", "good_name")
def func(good_name): ...


matplotlib._api.deprecation.warn_deprecated(since, *, message='', name='', alternative='', pending=False, obj_type='', addendum='', removal='')[source]

Display a standardized deprecation.  Parameters

sincestr

The release at which this API became deprecated.
messagestr, optional

Override the default deprecation message. The %(since)s, %(name)s, %(alternative)s, %(obj_type)s, %(addendum)s, and %(removal)s format specifiers will be replaced by the values of the respective arguments passed to this function.
namestr, optional

The name of the deprecated object.
alternativestr, optional

An alternative API that the user may use in place of the deprecated API. The deprecation warning will tell the user about this alternative if provided.
pendingbool, optional

If True, uses a PendingDeprecationWarning instead of a DeprecationWarning. Cannot be used together with removal.
obj_typestr, optional

The object type being deprecated.
addendumstr, optional

Additional text appended directly to the final message.
removalstr, optional

The expected removal version. With the default (an empty string), a removal version is automatically computed from since. Set to other Falsy values to not schedule a removal date. Cannot be used together with pending.     Examples # To warn of the deprecation of "matplotlib.name_of_module"
warn_deprecated('1.4.0', name='matplotlib.name_of_module',
                obj_type='module')


matplotlib._api.select_matching_signature(funcs, *args, **kwargs)[source]

Select and call the function that accepts *args, **kwargs. funcs is a list of functions which should not raise any exception (other than TypeError if the arguments passed do not match their signature). select_matching_signature tries to call each of the functions in funcs with *args, **kwargs (in the order in which they are given). Calls that fail with a TypeError are silently skipped. As soon as a call succeeds, select_matching_signature returns its return value. If no function accepts *args, **kwargs, then the TypeError raised by the last failing call is re-raised. Callers should normally make sure that any *args, **kwargs can only bind a single func (to avoid any ambiguity), although this is not checked by select_matching_signature. Notes select_matching_signature is intended to help implementing signature-overloaded functions. In general, such functions should be avoided, except for back-compatibility concerns. A typical use pattern is def my_func(*args, **kwargs):
    params = select_matching_signature(
        [lambda old1, old2: locals(), lambda new: locals()],
        *args, **kwargs)
    if "old1" in params:
        warn_deprecated(...)
        old1, old2 = params.values()  # note that locals() is ordered.
    else:
        new, = params.values()
    # do things with params
 which allows my_func to be called either with two parameters (old1 and old2) or a single one (new). Note that the new signature is given last, so that callers get a TypeError corresponding to the new signature if the arguments they passed in do not match any signature.


matplotlib._api.warn_external(message, category=None)[source]

warnings.warn wrapper that sets stacklevel to "outside Matplotlib". The original emitter of the warning can be obtained by patching this function back to warnings.warn, i.e. _api.warn_external =
warnings.warn (or functools.partial(warnings.warn, stacklevel=2), etc.).


matplotlib._enums Enums representing sets of strings that Matplotlib uses as input parameters. Matplotlib often uses simple data types like strings or tuples to define a concept; e.g. the line capstyle can be specified as one of 'butt', 'round', or 'projecting'. The classes in this module are used internally and serve to document these concepts formally. As an end-user you will not use these classes directly, but only the values they define.   classmatplotlib._enums.JoinStyle(value)[source]

Define how the connection between two line segments is drawn. For a visual impression of each JoinStyle, view these docs online, or run JoinStyle.demo. Lines in Matplotlib are typically defined by a 1D Path and a finite linewidth, where the underlying 1D Path represents the center of the stroked line. By default, GraphicsContextBase defines the boundaries of a stroked line to simply be every point within some radius, linewidth/2, away from any point of the center line. However, this results in corners appearing "rounded", which may not be the desired behavior if you are drawing, for example, a polygon or pointed star. Supported values:  'miter'

the "arrow-tip" style. Each boundary of the filled-in area will extend in a straight line parallel to the tangent vector of the centerline at the point it meets the corner, until they meet in a sharp point.  'round'

stokes every point within a radius of linewidth/2 of the center lines.  'bevel'

the "squared-off" style. It can be thought of as a rounded corner where the "circular" part of the corner has been cut off.    Note Very long miter tips are cut off (to form a bevel) after a backend-dependent limit called the "miter limit", which specifies the maximum allowed ratio of miter length to line width. For example, the PDF backend uses the default value of 10 specified by the PDF standard, while the SVG backend does not even specify the miter limit, resulting in a default value of 4 per the SVG specification. Matplotlib does not currently allow the user to adjust this parameter. A more detailed description of the effect of a miter limit can be found in the Mozilla Developer Docs  (Source code, png, pdf)      staticdemo()[source]

Demonstrate how each JoinStyle looks for various join angles.

   classmatplotlib._enums.CapStyle(value)[source]

Define how the two endpoints (caps) of an unclosed line are drawn. How to draw the start and end points of lines that represent a closed curve (i.e. that end in a CLOSEPOLY) is controlled by the line's JoinStyle. For all other lines, how the start and end points are drawn is controlled by the CapStyle. For a visual impression of each CapStyle, view these docs online or run CapStyle.demo. Supported values:  'butt'

the line is squared off at its endpoint.  'projecting'

the line is squared off as in butt, but the filled in area extends beyond the endpoint a distance of linewidth/2.  'round'

like butt, but a semicircular cap is added to the end of the line, of radius linewidth/2.   (Source code, png, pdf)      staticdemo()[source]

Demonstrate how each CapStyle looks for a thick line segment.


classmatplotlib._enums.CapStyle(value)[source]

Define how the two endpoints (caps) of an unclosed line are drawn. How to draw the start and end points of lines that represent a closed curve (i.e. that end in a CLOSEPOLY) is controlled by the line's JoinStyle. For all other lines, how the start and end points are drawn is controlled by the CapStyle. For a visual impression of each CapStyle, view these docs online or run CapStyle.demo. Supported values:  'butt'

the line is squared off at its endpoint.  'projecting'

the line is squared off as in butt, but the filled in area extends beyond the endpoint a distance of linewidth/2.  'round'

like butt, but a semicircular cap is added to the end of the line, of radius linewidth/2.   (Source code, png, pdf)      staticdemo()[source]

Demonstrate how each CapStyle looks for a thick line segment.


staticdemo()[source]

Demonstrate how each CapStyle looks for a thick line segment.


classmatplotlib._enums.JoinStyle(value)[source]

Define how the connection between two line segments is drawn. For a visual impression of each JoinStyle, view these docs online, or run JoinStyle.demo. Lines in Matplotlib are typically defined by a 1D Path and a finite linewidth, where the underlying 1D Path represents the center of the stroked line. By default, GraphicsContextBase defines the boundaries of a stroked line to simply be every point within some radius, linewidth/2, away from any point of the center line. However, this results in corners appearing "rounded", which may not be the desired behavior if you are drawing, for example, a polygon or pointed star. Supported values:  'miter'

the "arrow-tip" style. Each boundary of the filled-in area will extend in a straight line parallel to the tangent vector of the centerline at the point it meets the corner, until they meet in a sharp point.  'round'

stokes every point within a radius of linewidth/2 of the center lines.  'bevel'

the "squared-off" style. It can be thought of as a rounded corner where the "circular" part of the corner has been cut off.    Note Very long miter tips are cut off (to form a bevel) after a backend-dependent limit called the "miter limit", which specifies the maximum allowed ratio of miter length to line width. For example, the PDF backend uses the default value of 10 specified by the PDF standard, while the SVG backend does not even specify the miter limit, resulting in a default value of 4 per the SVG specification. Matplotlib does not currently allow the user to adjust this parameter. A more detailed description of the effect of a miter limit can be found in the Mozilla Developer Docs  (Source code, png, pdf)      staticdemo()[source]

Demonstrate how each JoinStyle looks for various join angles.


staticdemo()[source]

Demonstrate how each JoinStyle looks for various join angles.


matplotlib.afm A python interface to Adobe Font Metrics Files. Although a number of other Python implementations exist, and may be more complete than this, it was decided not to go with them because they were either:  copyrighted or used a non-BSD compatible license had too many dependencies and a free standing lib was needed did more than needed and it was easier to write afresh rather than figure out how to get just what was needed.  It is pretty easy to use, and has no external dependencies: >>> import matplotlib as mpl
>>> from pathlib import Path
>>> afm_path = Path(mpl.get_data_path(), 'fonts', 'afm', 'ptmr8a.afm')
>>>
>>> from matplotlib.afm import AFM
>>> with afm_path.open('rb') as fh:
...     afm = AFM(fh)
>>> afm.string_width_height('What the heck?')
(6220.0, 694)
>>> afm.get_fontname()
'Times-Roman'
>>> afm.get_kern_dist('A', 'f')
0
>>> afm.get_kern_dist('A', 'y')
-92.0
>>> afm.get_bbox_char('!')
[130, -9, 238, 676]
 As in the Adobe Font Metrics File Format Specification, all dimensions are given in units of 1/1000 of the scale factor (point size) of the font being used.   classmatplotlib.afm.AFM(fh)[source]

Bases: object Parse the AFM file in file object fh.   propertyfamily_name

The font family name, e.g., 'Times'.
   get_angle()[source]

Return the fontangle as float.
   get_bbox_char(c, isord=False)[source]

   get_capheight()[source]

Return the cap height as float.
   get_familyname()[source]

Return the font family name, e.g., 'Times'.
   get_fontname()[source]

Return the font name, e.g., 'Times-Roman'.
   get_fullname()[source]

Return the font full name, e.g., 'Times-Roman'.
   get_height_char(c, isord=False)[source]

Get the bounding box (ink) height of character c (space is 0).
   get_horizontal_stem_width()[source]

Return the standard horizontal stem width as float, or None if not specified in AFM file.
   get_kern_dist(c1, c2)[source]

Return the kerning pair distance (possibly 0) for chars c1 and c2.
   get_kern_dist_from_name(name1, name2)[source]

Return the kerning pair distance (possibly 0) for chars name1 and name2.
   get_name_char(c, isord=False)[source]

Get the name of the character, i.e., ';' is 'semicolon'.
   get_str_bbox(s)[source]

Return the string bounding box.
   get_str_bbox_and_descent(s)[source]

Return the string bounding box and the maximal descent.
   get_underline_thickness()[source]

Return the underline thickness as float.
   get_vertical_stem_width()[source]

Return the standard vertical stem width as float, or None if not specified in AFM file.
   get_weight()[source]

Return the font weight, e.g., 'Bold' or 'Roman'.
   get_width_char(c, isord=False)[source]

Get the width of the character from the character metric WX field.
   get_width_from_char_name(name)[source]

Get the width of the character from a type1 character name.
   get_xheight()[source]

Return the xheight as float.
   propertypostscript_name

   string_width_height(s)[source]

Return the string width (including kerning) and string height as a (w, h) tuple.

   classmatplotlib.afm.CharMetrics(width, name, bbox)[source]

Bases: tuple Represents the character metrics of a single character. Notes The fields do currently only describe a subset of character metrics information defined in the AFM standard. Create new instance of CharMetrics(width, name, bbox)   bbox

The bbox of the character (B) as a tuple (llx, lly, urx, ury).
   name

The character name (N).
   width

The character width (WX).

   classmatplotlib.afm.CompositePart(name, dx, dy)[source]

Bases: tuple Represents the information on a composite element of a composite char. Create new instance of CompositePart(name, dx, dy)   dx

x-displacement of the part from the origin.
   dy

y-displacement of the part from the origin.
   name

Name of the part, e.g. 'acute'.


classmatplotlib.afm.AFM(fh)[source]

Bases: object Parse the AFM file in file object fh.   propertyfamily_name

The font family name, e.g., 'Times'.
   get_angle()[source]

Return the fontangle as float.
   get_bbox_char(c, isord=False)[source]

   get_capheight()[source]

Return the cap height as float.
   get_familyname()[source]

Return the font family name, e.g., 'Times'.
   get_fontname()[source]

Return the font name, e.g., 'Times-Roman'.
   get_fullname()[source]

Return the font full name, e.g., 'Times-Roman'.
   get_height_char(c, isord=False)[source]

Get the bounding box (ink) height of character c (space is 0).
   get_horizontal_stem_width()[source]

Return the standard horizontal stem width as float, or None if not specified in AFM file.
   get_kern_dist(c1, c2)[source]

Return the kerning pair distance (possibly 0) for chars c1 and c2.
   get_kern_dist_from_name(name1, name2)[source]

Return the kerning pair distance (possibly 0) for chars name1 and name2.
   get_name_char(c, isord=False)[source]

Get the name of the character, i.e., ';' is 'semicolon'.
   get_str_bbox(s)[source]

Return the string bounding box.
   get_str_bbox_and_descent(s)[source]

Return the string bounding box and the maximal descent.
   get_underline_thickness()[source]

Return the underline thickness as float.
   get_vertical_stem_width()[source]

Return the standard vertical stem width as float, or None if not specified in AFM file.
   get_weight()[source]

Return the font weight, e.g., 'Bold' or 'Roman'.
   get_width_char(c, isord=False)[source]

Get the width of the character from the character metric WX field.
   get_width_from_char_name(name)[source]

Get the width of the character from a type1 character name.
   get_xheight()[source]

Return the xheight as float.
   propertypostscript_name

   string_width_height(s)[source]

Return the string width (including kerning) and string height as a (w, h) tuple.


get_angle()[source]

Return the fontangle as float.


get_capheight()[source]

Return the cap height as float.


get_familyname()[source]

Return the font family name, e.g., 'Times'.


get_fontname()[source]

Return the font name, e.g., 'Times-Roman'.


get_fullname()[source]

Return the font full name, e.g., 'Times-Roman'.


get_height_char(c, isord=False)[source]

Get the bounding box (ink) height of character c (space is 0).


get_horizontal_stem_width()[source]

Return the standard horizontal stem width as float, or None if not specified in AFM file.


get_kern_dist(c1, c2)[source]

Return the kerning pair distance (possibly 0) for chars c1 and c2.


get_kern_dist_from_name(name1, name2)[source]

Return the kerning pair distance (possibly 0) for chars name1 and name2.


get_name_char(c, isord=False)[source]

Get the name of the character, i.e., ';' is 'semicolon'.


get_str_bbox(s)[source]

Return the string bounding box.


get_str_bbox_and_descent(s)[source]

Return the string bounding box and the maximal descent.


get_underline_thickness()[source]

Return the underline thickness as float.


get_vertical_stem_width()[source]

Return the standard vertical stem width as float, or None if not specified in AFM file.


get_weight()[source]

Return the font weight, e.g., 'Bold' or 'Roman'.


get_width_char(c, isord=False)[source]

Get the width of the character from the character metric WX field.


get_width_from_char_name(name)[source]

Get the width of the character from a type1 character name.


get_xheight()[source]

Return the xheight as float.


string_width_height(s)[source]

Return the string width (including kerning) and string height as a (w, h) tuple.


classmatplotlib.afm.CharMetrics(width, name, bbox)[source]

Bases: tuple Represents the character metrics of a single character. Notes The fields do currently only describe a subset of character metrics information defined in the AFM standard. Create new instance of CharMetrics(width, name, bbox)   bbox

The bbox of the character (B) as a tuple (llx, lly, urx, ury).
   name

The character name (N).
   width

The character width (WX).


bbox

The bbox of the character (B) as a tuple (llx, lly, urx, ury).


classmatplotlib.afm.CompositePart(name, dx, dy)[source]

Bases: tuple Represents the information on a composite element of a composite char. Create new instance of CompositePart(name, dx, dy)   dx

x-displacement of the part from the origin.
   dy

y-displacement of the part from the origin.
   name

Name of the part, e.g. 'acute'.


dx

x-displacement of the part from the origin.


dy

y-displacement of the part from the origin.


matplotlib.animation Table of Contents  Inheritance Diagrams Animation Writer Classes Helper Classes   Inheritance Diagrams                    Animation The easiest way to make a live animation in Matplotlib is to use one of the Animation classes.
Animation A base class for Animations.
FuncAnimation Makes an animation by repeatedly calling a function func.
ArtistAnimation Animation using a fixed set of Artist objects.   In both cases it is critical to keep a reference to the instance object. The animation is advanced by a timer (typically from the host GUI framework) which the Animation object holds the only reference to. If you do not hold a reference to the Animation object, it (and hence the timers) will be garbage collected which will stop the animation. To save an animation use Animation.save, Animation.to_html5_video, or Animation.to_jshtml. See Helper Classes below for details about what movie formats are supported.  FuncAnimation The inner workings of FuncAnimation is more-or-less: for d in frames:
   artists = func(d, *fargs)
   fig.canvas.draw_idle()
   fig.canvas.start_event_loop(interval)
 with details to handle 'blitting' (to dramatically improve the live performance), to be non-blocking, not repeatedly start/stop the GUI event loop, handle repeats, multiple animated axes, and easily save the animation to a movie file. 'Blitting' is a standard technique in computer graphics. The general gist is to take an existing bit map (in our case a mostly rasterized figure) and then 'blit' one more artist on top. Thus, by managing a saved 'clean' bitmap, we can only re-draw the few artists that are changing at each frame and possibly save significant amounts of time. When we use blitting (by passing blit=True), the core loop of FuncAnimation gets a bit more complicated: ax = fig.gca()

def update_blit(artists):
    fig.canvas.restore_region(bg_cache)
    for a in artists:
        a.axes.draw_artist(a)

    ax.figure.canvas.blit(ax.bbox)

artists = init_func()

for a in artists:
   a.set_animated(True)

fig.canvas.draw()
bg_cache = fig.canvas.copy_from_bbox(ax.bbox)

for f in frames:
    artists = func(f, *fargs)
    update_blit(artists)
    fig.canvas.start_event_loop(interval)
 This is of course leaving out many details (such as updating the background when the figure is resized or fully re-drawn). However, this hopefully minimalist example gives a sense of how init_func and func are used inside of FuncAnimation and the theory of how 'blitting' works. The expected signature on func and init_func is very simple to keep FuncAnimation out of your book keeping and plotting logic, but this means that the callable objects you pass in must know what artists they should be working on. There are several approaches to handling this, of varying complexity and encapsulation. The simplest approach, which works quite well in the case of a script, is to define the artist at a global scope and let Python sort things out. For example import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

fig, ax = plt.subplots()
xdata, ydata = [], []
ln, = plt.plot([], [], 'ro')

def init():
    ax.set_xlim(0, 2*np.pi)
    ax.set_ylim(-1, 1)
    return ln,

def update(frame):
    xdata.append(frame)
    ydata.append(np.sin(frame))
    ln.set_data(xdata, ydata)
    return ln,

ani = FuncAnimation(fig, update, frames=np.linspace(0, 2*np.pi, 128),
                    init_func=init, blit=True)
plt.show()
 The second method is to use functools.partial to 'bind' artists to function. A third method is to use closures to build up the required artists and functions. A fourth method is to create a class.  Examples  Decay The Bayes update The double pendulum problem Animated histogram Rain simulation Animated 3D random walk Animated line plot Oscilloscope MATPLOTLIB UNCHAINED     ArtistAnimation  Examples  Animated image using a precomputed list of images      Writer Classes The provided writers fall into a few broad categories. The Pillow writer relies on the Pillow library to write the animation, keeping all data in memory.
PillowWriter    The HTML writer generates JavaScript-based animations.
HTMLWriter Writer for JavaScript-based HTML movies.   The pipe-based writers stream the captured frames over a pipe to an external process. The pipe-based variants tend to be more performant, but may not work on all systems.
FFMpegWriter Pipe-based ffmpeg writer.
ImageMagickWriter Pipe-based animated gif.   The file-based writers save temporary files for each frame which are stitched into a single file at the end. Although slower, these writers can be easier to debug.
FFMpegFileWriter File-based ffmpeg writer.
ImageMagickFileWriter File-based animated gif writer.   Fundamentally, a MovieWriter provides a way to grab sequential frames from the same underlying Figure object. The base class MovieWriter implements 3 methods and a context manager. The only difference between the pipe-based and file-based writers is in the arguments to their respective setup methods. The setup() method is used to prepare the writer (possibly opening a pipe), successive calls to grab_frame() capture a single frame at a time and finish() finalizes the movie and writes the output file to disk. For example moviewriter = MovieWriter(...)
moviewriter.setup(fig, 'my_movie.ext', dpi=100)
for j in range(n):
    update_figure(j)
    moviewriter.grab_frame()
moviewriter.finish()
 If using the writer classes directly (not through Animation.save), it is strongly encouraged to use the saving context manager with moviewriter.saving(fig, 'myfile.mp4', dpi=100):
    for j in range(n):
        update_figure(j)
        moviewriter.grab_frame()
 to ensures that setup and cleanup are performed as necessary.  Examples  Frame grabbing     Helper Classes  Animation Base Classes
Animation A base class for Animations.
TimedAnimation Animation subclass for time-based animation.     Writer Registry A module-level registry is provided to map between the name of the writer and the class to allow a string to be passed to Animation.save instead of a writer instance.
MovieWriterRegistry Registry of available writer classes by human readable name.     Writer Base Classes To reduce code duplication base classes
AbstractMovieWriter Abstract base class for writing movies.
MovieWriter Base class for writing movies.
FileMovieWriter MovieWriter for writing to individual files and stitching at the end.   and mixins
FFMpegBase Mixin class for FFMpeg output.
ImageMagickBase Mixin class for ImageMagick output.   are provided. See the source code for how to easily implement new MovieWriter classes.


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

Abstract 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(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
__init__([fps, metadata, codec, bitrate])
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi]) Setup for writing the movie file.   Attributes
frame_size A tuple (width, height) in pixels of a movie frame.     abstractfinish()[source]

Finish any processing for writing the movie.
   propertyframe_size

A tuple (width, height) in pixels of a movie frame.
   abstractgrab_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.
   saving(fig, outfile, dpi, *args, **kwargs)

Context manager to facilitate writing the movie file. *args, **kw are any parameters that should be passed to setup.
   abstractsetup(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.


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


abstractfinish()[source]

Finish any processing for writing the movie.


abstractgrab_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.


saving(fig, outfile, dpi, *args, **kwargs)

Context manager to facilitate writing the movie file. *args, **kw are any parameters that should be passed to setup.


abstractsetup(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.


matplotlib.animation.Animation   classmatplotlib.animation.Animation(fig, event_source=None, blit=False)[source]

A base class for Animations. This class is not usable as is, and should be subclassed to provide needed behavior.  Note You must store the created Animation in a variable that lives as long as the animation should run. Otherwise, the Animation object will be garbage-collected and the animation stops.   Parameters

figFigure

The figure object used to get needed events, such as draw or resize.
event_sourceobject, optional

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.
blitbool, default: False

Whether blitting is used to optimize drawing.      See also
FuncAnimation, ArtistAnimation

    __init__(fig, event_source=None, blit=False)[source]

 Methods
__init__(fig[, event_source, blit])
new_frame_seq() Return a new sequence of frame information.
new_saved_frame_seq() Return a new sequence of saved/cached frame information.
pause() Pause the animation.
resume() Resume the animation.
save(filename[, writer, fps, dpi, codec, ...]) Save the animation as a movie file by drawing every frame.
to_html5_video([embed_limit]) Convert the animation to an HTML5 <video> tag.
to_jshtml([fps, embed_frames, default_mode]) Generate HTML representation of the animation.     new_frame_seq()[source]

Return a new sequence of frame information.
   new_saved_frame_seq()[source]

Return a new sequence of saved/cached frame information.
   pause()[source]

Pause the animation.
   resume()[source]

Resume the animation.
   save(filename, writer=None, fps=None, dpi=None, codec=None, bitrate=None, extra_args=None, metadata=None, extra_anim=None, savefig_kwargs=None, *, progress_callback=None)[source]

Save the animation as a movie file by drawing every frame.  Parameters

filenamestr

The output filename, e.g., mymovie.mp4.
writerMovieWriter or str, default: rcParams["animation.writer"] (default: 'ffmpeg')

A MovieWriter instance to use or a key that identifies a class to use, such as 'ffmpeg'.
fpsint, optional

Movie frame rate (per second). If not set, the frame rate from the animation's frame interval.
dpifloat, default: rcParams["savefig.dpi"] (default: 'figure')

Controls the dots per inch for the movie frames. Together with the figure's size in inches, this controls the size of the movie.
codecstr, default: rcParams["animation.codec"] (default: 'h264').

The video codec to use. Not all codecs are supported by a given MovieWriter.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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_animlist, default: []

Additional Animation objects that should be included in the saved movie file. These need to be from the same matplotlib.figure.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_kwargsdict, default: {}

Keyword arguments passed to each savefig call used to save the individual frames.
progress_callbackfunction, optional

A callback function that will be called for every frame to notify the saving progress. It must have the signature def func(current_frame: int, total_frames: int) -> Any
 where current_frame is the current frame number and total_frames is the total number of frames to be saved. total_frames is set to None, if the total number of frames can not be determined. Return values may exist but are ignored. Example code to write the progress to stdout: progress_callback =                    lambda i, n: print(f'Saving frame {i} of {n}')
     Notes fps, codec, bitrate, extra_args and metadata are used to construct a MovieWriter instance and can only be passed if writer is a string. If they are passed as non-None and writer is a MovieWriter, a RuntimeError will be raised.
   to_html5_video(embed_limit=None)[source]

Convert the animation to an HTML5 <video> tag. This saves the animation as an h264 video, encoded in base64 directly into the HTML5 video tag. This respects rcParams["animation.writer"] (default: 'ffmpeg') and rcParams["animation.bitrate"] (default: -1). This also makes use of the interval to control the speed, and uses the repeat parameter to decide whether to loop.  Parameters

embed_limitfloat, optional

Limit, in MB, of the returned animation. No animation is created if the limit is exceeded. Defaults to rcParams["animation.embed_limit"] (default: 20.0) = 20.0.    Returns
 str

An HTML5 video tag with the animation embedded as base64 encoded h264 video. If the embed_limit is exceeded, this returns the string "Video too large to embed."
   to_jshtml(fps=None, embed_frames=True, default_mode=None)[source]

Generate HTML representation of the animation.  Parameters

fpsint, optional

Movie frame rate (per second). If not set, the frame rate from the animation's frame interval.
embed_framesbool, optional

default_modestr, optional

What to do when the animation ends. Must be one of {'loop',
'once', 'reflect'}. Defaults to 'loop' if self.repeat is True, otherwise 'once'.


new_frame_seq()[source]

Return a new sequence of frame information.


new_saved_frame_seq()[source]

Return a new sequence of saved/cached frame information.


save(filename, writer=None, fps=None, dpi=None, codec=None, bitrate=None, extra_args=None, metadata=None, extra_anim=None, savefig_kwargs=None, *, progress_callback=None)[source]

Save the animation as a movie file by drawing every frame.  Parameters

filenamestr

The output filename, e.g., mymovie.mp4.
writerMovieWriter or str, default: rcParams["animation.writer"] (default: 'ffmpeg')

A MovieWriter instance to use or a key that identifies a class to use, such as 'ffmpeg'.
fpsint, optional

Movie frame rate (per second). If not set, the frame rate from the animation's frame interval.
dpifloat, default: rcParams["savefig.dpi"] (default: 'figure')

Controls the dots per inch for the movie frames. Together with the figure's size in inches, this controls the size of the movie.
codecstr, default: rcParams["animation.codec"] (default: 'h264').

The video codec to use. Not all codecs are supported by a given MovieWriter.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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_animlist, default: []

Additional Animation objects that should be included in the saved movie file. These need to be from the same matplotlib.figure.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_kwargsdict, default: {}

Keyword arguments passed to each savefig call used to save the individual frames.
progress_callbackfunction, optional

A callback function that will be called for every frame to notify the saving progress. It must have the signature def func(current_frame: int, total_frames: int) -> Any
 where current_frame is the current frame number and total_frames is the total number of frames to be saved. total_frames is set to None, if the total number of frames can not be determined. Return values may exist but are ignored. Example code to write the progress to stdout: progress_callback =                    lambda i, n: print(f'Saving frame {i} of {n}')
     Notes fps, codec, bitrate, extra_args and metadata are used to construct a MovieWriter instance and can only be passed if writer is a string. If they are passed as non-None and writer is a MovieWriter, a RuntimeError will be raised.


to_html5_video(embed_limit=None)[source]

Convert the animation to an HTML5 <video> tag. This saves the animation as an h264 video, encoded in base64 directly into the HTML5 video tag. This respects rcParams["animation.writer"] (default: 'ffmpeg') and rcParams["animation.bitrate"] (default: -1). This also makes use of the interval to control the speed, and uses the repeat parameter to decide whether to loop.  Parameters

embed_limitfloat, optional

Limit, in MB, of the returned animation. No animation is created if the limit is exceeded. Defaults to rcParams["animation.embed_limit"] (default: 20.0) = 20.0.    Returns
 str

An HTML5 video tag with the animation embedded as base64 encoded h264 video. If the embed_limit is exceeded, this returns the string "Video too large to embed."


to_jshtml(fps=None, embed_frames=True, default_mode=None)[source]

Generate HTML representation of the animation.  Parameters

fpsint, optional

Movie frame rate (per second). If not set, the frame rate from the animation's frame interval.
embed_framesbool, optional

default_modestr, optional

What to do when the animation ends. Must be one of {'loop',
'once', 'reflect'}. Defaults to 'loop' if self.repeat is True, otherwise 'once'.


matplotlib.animation.ArtistAnimation   classmatplotlib.animation.ArtistAnimation(fig, artists, *args, **kwargs)[source]

Animation using a fixed set of Artist objects. Before creating an instance, all plotting should have taken place and the relevant artists saved.  Note You must store the created Animation in a variable that lives as long as the animation should run. Otherwise, the Animation object will be garbage-collected and the animation stops.   Parameters

figFigure

The figure object used to get needed events, such as draw or resize.
artistslist

Each list entry is a collection of Artist objects that are made visible on the corresponding frame. Other artists are made invisible.
intervalint, default: 200

Delay between frames in milliseconds.
repeat_delayint, default: 0

The delay in milliseconds between consecutive animation runs, if repeat is True.
repeatbool, default: True

Whether the animation repeats when the sequence of frames is completed.
blitbool, default: False

Whether blitting is used to optimize drawing.       __init__(fig, artists, *args, **kwargs)[source]

 Methods
__init__(fig, artists, *args, **kwargs)
new_frame_seq() Return a new sequence of frame information.
new_saved_frame_seq() Return a new sequence of saved/cached frame information.
pause() Pause the animation.
resume() Resume the animation.
save(filename[, writer, fps, dpi, codec, ...]) Save the animation as a movie file by drawing every frame.
to_html5_video([embed_limit]) Convert the animation to an HTML5 <video> tag.
to_jshtml([fps, embed_frames, default_mode]) Generate HTML representation of the animation.


__init__(fig, artists, *args, **kwargs)[source]


matplotlib.animation.FFMpegBase   classmatplotlib.animation.FFMpegBase[source]

Mixin class for FFMpeg output. To be useful this must be multiply-inherited from with a MovieWriterBase sub-class.   __init__(*args, **kwargs)

 Methods
__init__(*args, **kwargs)    Attributes
output_args      propertyoutput_args


matplotlib.animation.FFMpegFileWriter   classmatplotlib.animation.FFMpegFileWriter(*args, **kwargs)[source]

File-based ffmpeg writer. Frames are written to temporary files on disk and then stitched together at the end.   __init__(*args, **kwargs)[source]

 Methods
__init__(*args, **kwargs)
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi, frame_prefix]) Setup for writing the movie file.   Attributes
frame_format Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
frame_size A tuple (width, height) in pixels of a movie frame.
output_args
supported_formats      supported_formats=['png', 'jpeg', 'tiff', 'raw', 'rgba']


supported_formats=['png', 'jpeg', 'tiff', 'raw', 'rgba']


matplotlib.animation.FFMpegWriter   classmatplotlib.animation.FFMpegWriter(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

Pipe-based ffmpeg writer. Frames are streamed directly to ffmpeg via a pipe and written in a single pass.  Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.       __init__(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.
 Methods
__init__([fps, codec, bitrate, extra_args, ...])
 Parameters
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi]) Setup for writing the movie file.   Attributes
frame_size A tuple (width, height) in pixels of a movie frame.
output_args
supported_formats


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

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.


matplotlib.animation.FileMovieWriter   classmatplotlib.animation.FileMovieWriter(*args, **kwargs)[source]

MovieWriter for writing to individual files and stitching at the end. This must be sub-classed to be useful.  Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.       __init__(*args, **kwargs)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.
 Methods
__init__(*args, **kwargs)
 Parameters
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi, frame_prefix]) Setup for writing the movie file.   Attributes
frame_format Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
frame_size A tuple (width, height) in pixels of a movie frame.
supported_formats      finish()[source]

Finish any processing for writing the movie.
   propertyframe_format

Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
   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.
   setup(fig, outfile, dpi=None, frame_prefix=None)[source]

Setup for writing the movie file.  Parameters

figFigure

The figure to grab the rendered frames from.
outfilestr

The filename of the resulting movie file.
dpifloat, default: fig.dpi

The dpi of the output file. This, with the figure size, controls the size in pixels of the resulting movie file.
frame_prefixstr, optional

The filename prefix to use for temporary files. If None (the default), files are written to a temporary directory which is deleted by cleanup; if not None, no temporary files are deleted.


__init__(*args, **kwargs)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.


finish()[source]

Finish any processing for writing the movie.


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.


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

Setup for writing the movie file.  Parameters

figFigure

The figure to grab the rendered frames from.
outfilestr

The filename of the resulting movie file.
dpifloat, default: fig.dpi

The dpi of the output file. This, with the figure size, controls the size in pixels of the resulting movie file.
frame_prefixstr, optional

The filename prefix to use for temporary files. If None (the default), files are written to a temporary directory which is deleted by cleanup; if not None, no temporary files are deleted.


matplotlib.animation.FuncAnimation   classmatplotlib.animation.FuncAnimation(fig, func, frames=None, init_func=None, fargs=None, save_count=None, *, cache_frame_data=True, **kwargs)[source]

Makes an animation by repeatedly calling a function func.  Note You must store the created Animation in a variable that lives as long as the animation should run. Otherwise, the Animation object will be garbage-collected and the animation stops.   Parameters

figFigure

The figure object used to get needed events, such as draw or resize.
funccallable

The function to call at each frame. The first argument will be the next value in frames. Any additional positional arguments can be supplied via the fargs parameter. The required signature is: def func(frame, *fargs) -> iterable_of_artists
 If blit == True, func must return an iterable of all artists that were modified or created. This information is used by the blitting algorithm to determine which parts of the figure have to be updated. The return value is unused if blit == False and may be omitted in that case.
framesiterable, int, generator function, or None, optional

Source of data to pass func and each frame of the animation  If an iterable, then simply use the values provided. If the iterable has a length, it will override the save_count kwarg. If an integer, then equivalent to passing range(frames)

If a generator function, then must have the signature: def gen_function() -> obj
  If None, then equivalent to passing itertools.count.  In all of these cases, the values in frames is simply passed through to the user-supplied func and thus can be of any type.
init_funccallable, optional

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. The required signature is: def init_func() -> iterable_of_artists
 If blit == True, init_func must return an iterable of artists to be re-drawn. This information is used by the blitting algorithm to determine which parts of the figure have to be updated. The return value is unused if blit == False and may be omitted in that case.
fargstuple or None, optional

Additional arguments to pass to each call to func.
save_countint, default: 100

Fallback for the number of values from frames to cache. This is only used if the number of frames cannot be inferred from frames, i.e. when it's an iterator without length or a generator.
intervalint, default: 200

Delay between frames in milliseconds.
repeat_delayint, default: 0

The delay in milliseconds between consecutive animation runs, if repeat is True.
repeatbool, default: True

Whether the animation repeats when the sequence of frames is completed.
blitbool, default: False

Whether blitting is used to optimize drawing. Note: when using blitting, any animated artists will be drawn according to their zorder; however, they will be drawn on top of any previous artists, regardless of their zorder.
cache_frame_databool, default: True

Whether frame data is cached. Disabling cache might be helpful when frames contain large objects.       __init__(fig, func, frames=None, init_func=None, fargs=None, save_count=None, *, cache_frame_data=True, **kwargs)[source]

 Methods
__init__(fig, func[, frames, init_func, ...])
new_frame_seq() Return a new sequence of frame information.
new_saved_frame_seq() Return a new sequence of saved/cached frame information.
pause() Pause the animation.
resume() Resume the animation.
save(filename[, writer, fps, dpi, codec, ...]) Save the animation as a movie file by drawing every frame.
to_html5_video([embed_limit]) Convert the animation to an HTML5 <video> tag.
to_jshtml([fps, embed_frames, default_mode]) Generate HTML representation of the animation.     new_frame_seq()[source]

Return a new sequence of frame information.
   new_saved_frame_seq()[source]

Return a new sequence of saved/cached frame information.


__init__(fig, func, frames=None, init_func=None, fargs=None, save_count=None, *, cache_frame_data=True, **kwargs)[source]


new_frame_seq()[source]

Return a new sequence of frame information.


new_saved_frame_seq()[source]

Return a new sequence of saved/cached frame information.


matplotlib.animation.HTMLWriter   classmatplotlib.animation.HTMLWriter(fps=30, codec=None, bitrate=None, extra_args=None, metadata=None, embed_frames=False, default_mode='loop', embed_limit=None)[source]

Writer for JavaScript-based HTML movies.  Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.       __init__(fps=30, codec=None, bitrate=None, extra_args=None, metadata=None, embed_frames=False, default_mode='loop', embed_limit=None)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.
 Methods
__init__([fps, codec, bitrate, extra_args, ...])
 Parameters
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile, dpi[, frame_dir]) Setup for writing the movie file.   Attributes
frame_format Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
frame_size A tuple (width, height) in pixels of a movie frame.
supported_formats      finish()[source]

Finish any processing for writing the movie.
   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.
   classmethodisAvailable()[source]

Return whether a MovieWriter subclass is actually available.
   setup(fig, outfile, dpi, frame_dir=None)[source]

Setup for writing the movie file.  Parameters

figFigure

The figure to grab the rendered frames from.
outfilestr

The filename of the resulting movie file.
dpifloat, default: fig.dpi

The dpi of the output file. This, with the figure size, controls the size in pixels of the resulting movie file.
frame_prefixstr, optional

The filename prefix to use for temporary files. If None (the default), files are written to a temporary directory which is deleted by cleanup; if not None, no temporary files are deleted.
   supported_formats=['png', 'jpeg', 'tiff', 'svg']


__init__(fps=30, codec=None, bitrate=None, extra_args=None, metadata=None, embed_frames=False, default_mode='loop', embed_limit=None)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.


classmethodisAvailable()[source]

Return whether a MovieWriter subclass is actually available.


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

Setup for writing the movie file.  Parameters

figFigure

The figure to grab the rendered frames from.
outfilestr

The filename of the resulting movie file.
dpifloat, default: fig.dpi

The dpi of the output file. This, with the figure size, controls the size in pixels of the resulting movie file.
frame_prefixstr, optional

The filename prefix to use for temporary files. If None (the default), files are written to a temporary directory which is deleted by cleanup; if not None, no temporary files are deleted.


supported_formats=['png', 'jpeg', 'tiff', 'svg']


matplotlib.animation.ImageMagickBase   classmatplotlib.animation.ImageMagickBase[source]

Mixin class for ImageMagick output. To be useful this must be multiply-inherited from with a MovieWriterBase sub-class.   __init__(*args, **kwargs)

 Methods
__init__(*args, **kwargs)
bin_path()
isAvailable()    Attributes
delay
output_args      classmethodbin_path()[source]

   propertydelay

   classmethodisAvailable()[source]

   propertyoutput_args


matplotlib.animation.ImageMagickFileWriter   classmatplotlib.animation.ImageMagickFileWriter(*args, **kwargs)[source]

File-based animated gif writer. Frames are written to temporary files on disk and then stitched together at the end.   __init__(*args, **kwargs)[source]

 Methods
__init__(*args, **kwargs)
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi, frame_prefix]) Setup for writing the movie file.   Attributes
delay
frame_format Format (png, jpeg, etc.) to use for saving the frames, which can be decided by the individual subclasses.
frame_size A tuple (width, height) in pixels of a movie frame.
output_args
supported_formats      supported_formats=['png', 'jpeg', 'tiff', 'raw', 'rgba']


supported_formats=['png', 'jpeg', 'tiff', 'raw', 'rgba']


matplotlib.animation.ImageMagickWriter   classmatplotlib.animation.ImageMagickWriter(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

Pipe-based animated gif. Frames are streamed directly to ImageMagick via a pipe and written in a single pass.  Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.       __init__(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.
 Methods
__init__([fps, codec, bitrate, extra_args, ...])
 Parameters
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi]) Setup for writing the movie file.   Attributes
delay
frame_size A tuple (width, height) in pixels of a movie frame.
output_args
supported_formats


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

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.


matplotlib.animation.MovieWriter   classmatplotlib.animation.MovieWriter(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

Base class for writing movies. This is a base class for MovieWriter subclasses that write a movie frame data to a pipe. You cannot instantiate this class directly. See examples for how to use its subclasses.  Attributes

frame_formatstr

The format used in writing frame data, defaults to 'rgba'.
figFigure

The figure to capture data from. This must be provided by the sub-classes.      Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.       __init__(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)[source]

 Parameters

fpsint, default: 5

Movie frame rate (per second).
codecstr or None, default: rcParams["animation.codec"] (default: 'h264')

The codec to use.
bitrateint, default: rcParams["animation.bitrate"] (default: -1)

The bitrate of the movie, in kilobits per second. Higher values means higher quality movies, but increase the file size. A value of -1 lets the underlying movie encoder select the bitrate.
extra_argslist of str or None, optional

Extra command-line arguments passed to the underlying movie encoder. The default, None, means to use rcParams["animation.[name-of-encoder]_args"] for the builtin writers.
metadatadict[str, str], default: {}

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.
 Methods
__init__([fps, codec, bitrate, extra_args, ...])
 Parameters
bin_path() Return the binary path to the commandline tool used by a specific subclass.
cleanup() [Deprecated]
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable() Return whether a MovieWriter subclass is actually available.
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi]) Setup for writing the movie file.   Attributes
frame_size A tuple (width, height) in pixels of a movie frame.
supported_formats      classmethodbin_path()[source]

Return 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.
   cleanup()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   finish()[source]

Finish any processing for writing the movie.
   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.
   classmethodisAvailable()[source]

Return whether a MovieWriter subclass is actually available.
   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.
   supported_formats=['rgba']


classmethodbin_path()[source]

Return 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.


cleanup()[source]

[Deprecated] Notes  Deprecated since version 3.4:


finish()[source]

Finish any processing for writing the movie.


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.


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.


matplotlib.animation.MovieWriterRegistry   classmatplotlib.animation.MovieWriterRegistry[source]

Registry of available writer classes by human readable name.   __init__()[source]

 Methods
__init__()
is_available(name) Check if given writer is available by name.
list() Get a list of available MovieWriters.
register(name) Decorator for registering a class under a name.     is_available(name)[source]

Check if given writer is available by name.  Parameters

namestr

  Returns
 bool

   list()[source]

Get a list of available MovieWriters.
   register(name)[source]

Decorator for registering a class under a name. Example use: @registry.register(name)
class Foo:
    pass


is_available(name)[source]

Check if given writer is available by name.  Parameters

namestr

  Returns
 bool


list()[source]

Get a list of available MovieWriters.


register(name)[source]

Decorator for registering a class under a name. Example use: @registry.register(name)
class Foo:
    pass


matplotlib.animation.PillowWriter   classmatplotlib.animation.PillowWriter(fps=5, metadata=None, codec=None, bitrate=None)[source]

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

 Methods
__init__([fps, metadata, codec, bitrate])
finish() Finish any processing for writing the movie.
grab_frame(**savefig_kwargs) Grab the image information from the figure and save as a movie frame.
isAvailable()
saving(fig, outfile, dpi, *args, **kwargs) Context manager to facilitate writing the movie file.
setup(fig, outfile[, dpi]) Setup for writing the movie file.   Attributes
frame_size A tuple (width, height) in pixels of a movie frame.     finish()[source]

Finish any processing for writing the movie.
   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.
   classmethodisAvailable()[source]

   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.


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


matplotlib.animation.TimedAnimation   classmatplotlib.animation.TimedAnimation(fig, interval=200, repeat_delay=0, repeat=True, event_source=None, *args, **kwargs)[source]

Animation subclass for time-based animation. A new frame is drawn every interval milliseconds.  Note You must store the created Animation in a variable that lives as long as the animation should run. Otherwise, the Animation object will be garbage-collected and the animation stops.   Parameters

figFigure

The figure object used to get needed events, such as draw or resize.
intervalint, default: 200

Delay between frames in milliseconds.
repeat_delayint, default: 0

The delay in milliseconds between consecutive animation runs, if repeat is True.
repeatbool, default: True

Whether the animation repeats when the sequence of frames is completed.
blitbool, default: False

Whether blitting is used to optimize drawing.       __init__(fig, interval=200, repeat_delay=0, repeat=True, event_source=None, *args, **kwargs)[source]

 Methods
__init__(fig[, interval, repeat_delay, ...])
new_frame_seq() Return a new sequence of frame information.
new_saved_frame_seq() Return a new sequence of saved/cached frame information.
pause() Pause the animation.
resume() Resume the animation.
save(filename[, writer, fps, dpi, codec, ...]) Save the animation as a movie file by drawing every frame.
to_html5_video([embed_limit]) Convert the animation to an HTML5 <video> tag.
to_jshtml([fps, embed_frames, default_mode]) Generate HTML representation of the animation.


__init__(fig, interval=200, repeat_delay=0, repeat=True, event_source=None, *args, **kwargs)[source]


matplotlib.artist  Inheritance Diagrams
Artist class   classmatplotlib.artist.Artist[source]

Abstract base class for objects that render into a FigureCanvas. Typically, all visible elements in a figure are subclasses of Artist.
  Interactive
Artist.add_callback Add a callback function that will be called whenever one of the Artist's properties changes.
Artist.remove_callback Remove a callback based on its observer id.
Artist.pchanged Call all of the registered callbacks.
Artist.get_cursor_data Return the cursor data for a given event.
Artist.format_cursor_data Return a string representation of data.
Artist.mouseover If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.
Artist.contains Test whether the artist contains the mouse event.
Artist.pick Process a pick event.
Artist.pickable Return whether the artist is pickable.
Artist.set_picker Define the picking behavior of the artist.
Artist.get_picker Return the picking behavior of the artist.     Clipping
Artist.set_clip_on Set whether the artist uses clipping.
Artist.get_clip_on Return whether the artist uses clipping.
Artist.set_clip_box Set the artist's clip Bbox.
Artist.get_clip_box Return the clipbox.
Artist.set_clip_path Set the artist's clip path.
Artist.get_clip_path Return the clip path.     Bulk Properties
Artist.update Update this artist's properties from the dict props.
Artist.update_from Copy properties from other to self.
Artist.properties Return a dictionary of all the properties of the artist.
Artist.set Set multiple properties at once.     Drawing
Artist.draw Draw the Artist (and its children) using the given renderer.
Artist.set_animated Set whether the artist is intended to be used in an animation.
Artist.get_animated Return whether the artist is animated.
Artist.set_alpha Set the alpha value used for blending - not supported on all backends.
Artist.get_alpha Return the alpha value used for blending - not supported on all backends.
Artist.set_snap Set the snapping behavior.
Artist.get_snap Return the snap setting.
Artist.set_visible Set the artist's visibility.
Artist.get_visible Return the visibility.
Artist.zorder
Artist.set_zorder Set the zorder for the artist.
Artist.get_zorder Return the artist's zorder.
Artist.set_agg_filter Set the agg filter.
Artist.set_sketch_params Set the sketch parameters.
Artist.get_sketch_params Return the sketch parameters for the artist.
Artist.set_rasterized Force rasterized (bitmap) drawing for vector graphics output.
Artist.get_rasterized Return whether the artist is to be rasterized.
Artist.set_path_effects Set the path effects.
Artist.get_path_effects
Artist.get_agg_filter Return filter function to be used for agg filter.
Artist.get_window_extent Get the artist's bounding box in display space.
Artist.get_transformed_clip_path_and_affine Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.     Figure and Axes
Artist.remove Remove the artist from the figure if possible.
Artist.axes The Axes instance the artist resides in, or None.
Artist.set_figure Set the Figure instance the artist belongs to.
Artist.get_figure Return the Figure instance the artist belongs to.     Children
Artist.get_children Return a list of the child Artists of this Artist.
Artist.findobj Find artist objects.     Transform
Artist.set_transform Set the artist transform.
Artist.get_transform Return the Transform instance used by this artist.
Artist.is_transform_set Return whether the Artist has an explicitly set transform.     Units
Artist.convert_xunits Convert x using the unit type of the xaxis.
Artist.convert_yunits Convert y using the unit type of the yaxis.
Artist.have_units Return whether units are set on any axis.     Metadata
Artist.set_gid Set the (group) id for the artist.
Artist.get_gid Return the group id.
Artist.set_label Set a label that will be displayed in the legend.
Artist.get_label Return the label used for this artist in the legend.
Artist.set_url Set the url for the artist.
Artist.get_url Return the url.     Miscellaneous
Artist.sticky_edges x and y sticky edge lists for autoscaling.
Artist.set_in_layout Set if artist is to be included in layout calculations, E.g.
Artist.get_in_layout Return boolean flag, True if artist is included in layout calculations.
Artist.stale Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.      Functions
allow_rasterization Decorator for Artist.draw method.
get Return the value of an Artist's property, or print all of them.
getp Return the value of an Artist's property, or print all of them.
setp Set one or more properties on an Artist, or list allowed values.
kwdoc Inspect an Artist class (using ArtistInspector) and return information about its settable properties and their current values.
ArtistInspector A helper class to inspect an Artist and return information about its settable properties and their current values.


matplotlib.artist.allow_rasterization   matplotlib.artist.allow_rasterization(draw)[source]

Decorator for Artist.draw method. Provides routines that run before and after the draw call. The before and after functions are useful for changing artist-dependent renderer attributes or making other setup function calls, such as starting and flushing a mixed-mode renderer.


classmatplotlib.artist.Artist[source]

Abstract base class for objects that render into a FigureCanvas. Typically, all visible elements in a figure are subclasses of Artist.


matplotlib.artist.Artist.add_callback   Artist.add_callback(func)[source]

Add a callback function that will be called whenever one of the Artist's properties changes.  Parameters

funccallable

The callback function. It must have the signature: def func(artist: Artist) -> Any
 where artist is the calling Artist. Return values may exist but are ignored.    Returns
 int

The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.      See also  remove_callback


matplotlib.artist.Artist.axes   propertyArtist.axes

The Axes instance the artist resides in, or None.


matplotlib.artist.Artist.contains   Artist.contains(mouseevent)[source]

Test whether the artist contains the mouse event.  Parameters

mouseeventmatplotlib.backend_bases.MouseEvent

  Returns

containsbool

Whether any values are within the radius.
detailsdict

An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details.


matplotlib.artist.Artist.convert_xunits   Artist.convert_xunits(x)[source]

Convert x using the unit type of the xaxis. If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.


matplotlib.artist.Artist.convert_yunits   Artist.convert_yunits(y)[source]

Convert y using the unit type of the yaxis. If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.


matplotlib.artist.Artist.draw   Artist.draw(renderer)[source]

Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.


matplotlib.artist.Artist.findobj   Artist.findobj(match=None, include_self=True)[source]

Find artist objects. Recursively find all Artist instances contained in the artist.  Parameters
 match

A filter criterion for the matches. This can be
None: Return all objects contained in artist. A function with signature def match(artist: Artist) -> bool. The result will only contain artists for which the function returns True. A class instance: e.g., Line2D. The result will only contain artists of this class or its subclasses (isinstance check).
include_selfbool

Include self in the list to be checked for a match.    Returns
 list of Artist


matplotlib.artist.Artist.format_cursor_data   Artist.format_cursor_data(data)[source]

Return a string representation of data.  Note This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.  The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter.  See also  get_cursor_data


matplotlib.artist.Artist.get_agg_filter   Artist.get_agg_filter()[source]

Return filter function to be used for agg filter.


matplotlib.artist.Artist.get_alpha   Artist.get_alpha()[source]

Return the alpha value used for blending - not supported on all backends.


matplotlib.artist.Artist.get_animated   Artist.get_animated()[source]

Return whether the artist is animated.


matplotlib.artist.Artist.get_children   Artist.get_children()[source]

Return a list of the child Artists of this Artist.


matplotlib.artist.Artist.get_clip_box   Artist.get_clip_box()[source]

Return the clipbox.


matplotlib.artist.Artist.get_clip_on   Artist.get_clip_on()[source]

Return whether the artist uses clipping.


matplotlib.artist.Artist.get_clip_path   Artist.get_clip_path()[source]

Return the clip path.


matplotlib.artist.Artist.get_cursor_data   Artist.get_cursor_data(event)[source]

Return the cursor data for a given event.  Note This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.  Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None. Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation. The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse.  Parameters

eventmatplotlib.backend_bases.MouseEvent

    See also  format_cursor_data


matplotlib.artist.Artist.get_figure   Artist.get_figure()[source]

Return the Figure instance the artist belongs to.


matplotlib.artist.Artist.get_gid   Artist.get_gid()[source]

Return the group id.


matplotlib.artist.Artist.get_in_layout   Artist.get_in_layout()[source]

Return boolean flag, True if artist is included in layout calculations. E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


matplotlib.artist.Artist.get_label   Artist.get_label()[source]

Return the label used for this artist in the legend.


matplotlib.artist.Artist.get_path_effects   Artist.get_path_effects()[source]


matplotlib.artist.Artist.get_picker   Artist.get_picker()[source]

Return the picking behavior of the artist. The possible values are described in set_picker.  See also
set_picker, pickable, pick


matplotlib.artist.Artist.get_rasterized   Artist.get_rasterized()[source]

Return whether the artist is to be rasterized.


matplotlib.artist.Artist.get_sketch_params   Artist.get_sketch_params()[source]

Return the sketch parameters for the artist.  Returns
 tuple or None

A 3-tuple with the following elements:
scale: The amplitude of the wiggle perpendicular to the source line.
length: The length of the wiggle along the line.
randomness: The scale factor by which the length is shrunken or expanded.  Returns None if no sketch parameters were set.


matplotlib.artist.Artist.get_snap   Artist.get_snap()[source]

Return the snap setting. See set_snap for details.


matplotlib.artist.Artist.get_transform   Artist.get_transform()[source]

Return the Transform instance used by this artist.


matplotlib.artist.Artist.get_transformed_clip_path_and_affine   Artist.get_transformed_clip_path_and_affine()[source]

Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.


matplotlib.artist.Artist.get_url   Artist.get_url()[source]

Return the url.


matplotlib.artist.Artist.get_visible   Artist.get_visible()[source]

Return the visibility.


matplotlib.artist.Artist.get_window_extent   Artist.get_window_extent(renderer)[source]

Get the artist's bounding box in display space. The bounding box' width and height are nonnegative. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0. Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.


matplotlib.artist.Artist.get_zorder   Artist.get_zorder()[source]

Return the artist's zorder.


matplotlib.artist.Artist.have_units   Artist.have_units()[source]

Return whether units are set on any axis.


matplotlib.artist.Artist.is_transform_set   Artist.is_transform_set()[source]

Return whether the Artist has an explicitly set transform. This is True after set_transform has been called.


matplotlib.artist.Artist.mouseover   propertyArtist.mouseover

If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it. See also get_cursor_data(), ToolCursorPosition and NavigationToolbar2.


matplotlib.artist.Artist.pchanged   Artist.pchanged()[source]

Call all of the registered callbacks. This function is triggered internally when a property is changed.  See also  add_callback
remove_callback


matplotlib.artist.Artist.pick   Artist.pick(mouseevent)[source]

Process a pick event. Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.  See also
set_picker, get_picker, pickable


matplotlib.artist.Artist.pickable   Artist.pickable()[source]

Return whether the artist is pickable.  See also
set_picker, get_picker, pick


matplotlib.artist.Artist.properties   Artist.properties()[source]

Return a dictionary of all the properties of the artist.


matplotlib.artist.Artist.remove   Artist.remove()[source]

Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry.


matplotlib.artist.Artist.remove_callback   Artist.remove_callback(oid)[source]

Remove a callback based on its observer id.  See also  add_callback


matplotlib.artist.Artist.set   Artist.set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
in_layout bool
label object
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float


matplotlib.artist.Artist.set_agg_filter   Artist.set_agg_filter(filter_func)[source]

Set the agg filter.  Parameters

filter_funccallable

A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.


matplotlib.artist.Artist.set_alpha   Artist.set_alpha(alpha)[source]

Set the alpha value used for blending - not supported on all backends.  Parameters

alphascalar or None

alpha must be within the 0-1 range, inclusive.


matplotlib.artist.Artist.set_animated   Artist.set_animated(b)[source]

Set whether the artist is intended to be used in an animation. If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting. See also matplotlib.animation and Faster rendering by using blitting.  Parameters

bbool


matplotlib.artist.Artist.set_clip_box   Artist.set_clip_box(clipbox)[source]

Set the artist's clip Bbox.  Parameters

clipboxBbox


matplotlib.artist.Artist.set_clip_on   Artist.set_clip_on(b)[source]

Set whether the artist uses clipping. When False artists will be visible outside of the axes which can lead to unexpected results.  Parameters

bbool


matplotlib.artist.Artist.set_clip_path   Artist.set_clip_path(path, transform=None)[source]

Set the artist's clip path.  Parameters

pathPatch or Path or TransformedPath or None

The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
transformTransform, optional

Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.     Notes For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None. For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.


matplotlib.artist.Artist.set_figure   Artist.set_figure(fig)[source]

Set the Figure instance the artist belongs to.  Parameters

figFigure


matplotlib.artist.Artist.set_gid   Artist.set_gid(gid)[source]

Set the (group) id for the artist.  Parameters

gidstr


matplotlib.artist.Artist.set_in_layout   Artist.set_in_layout(in_layout)[source]

Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').  Parameters

in_layoutbool


matplotlib.artist.Artist.set_label   Artist.set_label(s)[source]

Set a label that will be displayed in the legend.  Parameters

sobject

s will be converted to a string by calling str.


matplotlib.artist.Artist.set_path_effects   Artist.set_path_effects(path_effects)[source]

Set the path effects.  Parameters

path_effectsAbstractPathEffect


matplotlib.artist.Artist.set_picker   Artist.set_picker(picker)[source]

Define the picking behavior of the artist.  Parameters

pickerNone or bool or float or callable

This can be one of the following:
None: Picking is disabled for this artist (default). A boolean: If True then picking will be enabled and the artist will fire a pick event if the mouse event is over the artist. A float: If picker is a number it is interpreted as an epsilon tolerance in points and the artist will fire off an event if its data is within epsilon of the mouse event. For some artists like lines and patch collections, the artist may provide additional data to the pick event that is generated, e.g., the indices of the data within epsilon of the pick event
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event: hit, props = picker(artist, mouseevent)
 to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.


matplotlib.artist.Artist.set_rasterized   Artist.set_rasterized(rasterized)[source]

Force rasterized (bitmap) drawing for vector graphics output. Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued. This setting is ignored for pixel-based output. See also Rasterization for vector graphics.  Parameters

rasterizedbool


matplotlib.artist.Artist.set_sketch_params   Artist.set_sketch_params(scale=None, length=None, randomness=None)[source]

Set the sketch parameters.  Parameters

scalefloat, optional

The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
lengthfloat, optional

The length of the wiggle along the line, in pixels (default 128.0)
randomnessfloat, optional

The scale factor by which the length is shrunken or expanded (default 16.0) The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.


matplotlib.artist.Artist.set_snap   Artist.set_snap(snap)[source]

Set the snapping behavior. Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line. Snapping is currently only supported by the Agg and MacOSX backends.  Parameters

snapbool or None

Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center.


matplotlib.artist.Artist.set_transform   Artist.set_transform(t)[source]

Set the artist transform.  Parameters

tTransform


matplotlib.artist.Artist.set_url   Artist.set_url(url)[source]

Set the url for the artist.  Parameters

urlstr


matplotlib.artist.Artist.set_visible   Artist.set_visible(b)[source]

Set the artist's visibility.  Parameters

bbool


matplotlib.artist.Artist.set_zorder   Artist.set_zorder(level)[source]

Set the zorder for the artist. Artists with lower zorder values are drawn first.  Parameters

levelfloat


matplotlib.artist.Artist.stale   propertyArtist.stale

Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.


matplotlib.artist.Artist.sticky_edges   propertyArtist.sticky_edges

x and y sticky edge lists for autoscaling. When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram. Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1. This attribute cannot be assigned to; however, the x and y lists can be modified in place as needed. Examples >>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)


matplotlib.artist.Artist.update   Artist.update(props)[source]

Update this artist's properties from the dict props.  Parameters

propsdict


matplotlib.artist.Artist.update_from   Artist.update_from(other)[source]

Copy properties from other to self.


matplotlib.artist.Artist.zorder   Artist.zorder=0