<divid="unreleased-message"> You are reading an old version of the documentation (v1.4.3). For the latest version see <ahref="https://matplotlib.org/stable/api/animation_api.html">https://matplotlib.org/stable/api/animation_api.html</a></div>
<spanid="matplotlib-animation"></span><h2><aclass="reference internal" href="#module-matplotlib.animation" title="matplotlib.animation"><ttclass="xref py py-mod docutils literal"><spanclass="pre">matplotlib.animation</span></tt></a><aclass="headerlink" href="#module-matplotlib.animation" title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="matplotlib.animation.AVConvBase">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">AVConvBase</tt><aclass="headerlink" href="#matplotlib.animation.AVConvBase" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">args_key</tt><emclass="property"> = u'animation.avconv_args'</em><aclass="headerlink" href="#matplotlib.animation.AVConvBase.args_key" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="matplotlib.animation.AVConvBase.exec_key">
<ttclass="descname">exec_key</tt><emclass="property"> = u'animation.avconv_path'</em><aclass="headerlink" href="#matplotlib.animation.AVConvBase.exec_key" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.AVConvFileWriter">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">AVConvFileWriter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.AVConvFileWriter" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">Animation</tt><big>(</big><em>fig</em>, <em>event_source=None</em>, <em>blit=False</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.Animation" title="Permalink to this definition">¶</a></dt>
<p>This class wraps the creation of an animation using matplotlib. It is
only a base class which should be subclassed to provide needed behavior.</p>
<p><em>fig</em> is the figure object that is used to get draw, resize, and any
other needed events.</p>
<p><em>event_source</em> is a class that can run a callback when desired events
are generated, as well as be stopped and started. Examples include timers
(see <aclass="reference internal" href="#matplotlib.animation.TimedAnimation" title="matplotlib.animation.TimedAnimation"><ttclass="xref py py-class docutils literal"><spanclass="pre">TimedAnimation</span></tt></a>) and file system notifications.</p>
<p><em>blit</em> is a boolean that controls whether blitting is used to optimize
<ttclass="descname">new_frame_seq</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.Animation.new_frame_seq" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new sequence of frame information.</p>
<ttclass="descname">new_saved_frame_seq</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.Animation.new_saved_frame_seq" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new sequence of saved/cached frame information.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.animation.Animation.save">
<ttclass="descname">save</tt><big>(</big><em>filename</em>, <em>writer=None</em>, <em>fps=None</em>, <em>dpi=None</em>, <em>codec=None</em>, <em>bitrate=None</em>, <em>extra_args=None</em>, <em>metadata=None</em>, <em>extra_anim=None</em>, <em>savefig_kwargs=None</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.Animation.save" title="Permalink to this definition">¶</a></dt>
<dd><p>Saves a movie file by drawing every frame.</p>
<p><em>filename</em> is the output filename, e.g., <ttclass="file docutils literal"><spanclass="pre">mymovie.mp4</span></tt></p>
<p><em>writer</em> is either an instance of <aclass="reference internal" href="#matplotlib.animation.MovieWriter" title="matplotlib.animation.MovieWriter"><ttclass="xref py py-class docutils literal"><spanclass="pre">MovieWriter</span></tt></a> or a string
key that identifies a class to use, such as ‘ffmpeg’ or ‘mencoder’.
If nothing is passed, the value of the rcparam <ttclass="xref py py-obj docutils literal"><spanclass="pre">animation.writer</span></tt> is
used.</p>
<p><em>fps</em> is the frames per second in the movie. Defaults to None,
which will use the animation’s specified interval to set the frames
per second.</p>
<p><em>dpi</em> controls the dots per inch for the movie frames. This combined
with the figure’s size in inches controls the size of the movie.</p>
<p><em>codec</em> is the video codec to be used. Not all codecs are supported
by a given <aclass="reference internal" href="#matplotlib.animation.MovieWriter" title="matplotlib.animation.MovieWriter"><ttclass="xref py py-class docutils literal"><spanclass="pre">MovieWriter</span></tt></a>. If none is given, this defaults to the
value specified by the rcparam <ttclass="xref py py-obj docutils literal"><spanclass="pre">animation.codec</span></tt>.</p>
<p><em>bitrate</em> specifies the amount of bits used per second in the
compressed movie, in kilobits per second. A higher number means a
higher quality movie, but at the cost of increased file size. If no
value is given, this defaults to the value given by the rcparam
<p><em>extra_anim</em> is a list of additional <aclass="reference internal" href="#matplotlib.animation.Animation" title="matplotlib.animation.Animation"><ttclass="xref py py-obj docutils literal"><spanclass="pre">Animation</span></tt></a> objects that should
be included in the saved movie file. These need to be from the same
<ttclass="xref py py-obj docutils literal"><spanclass="pre">matplotlib.Figure</span></tt> instance. Also, animation frames will just be
simply combined, so there should be a 1:1 correspondence between
the frames from the different animations.</p>
<p><em>savefig_kwargs</em> is a dictionary containing keyword arguments to be
passed on to the ‘savefig’ command which is called repeatedly to save
the individual frames. This can be used to set tight bounding boxes,
for example.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.ArtistAnimation">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">ArtistAnimation</tt><big>(</big><em>fig</em>, <em>artists</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.ArtistAnimation" title="Permalink to this definition">¶</a></dt>
<p>Before calling this function, all plotting should have taken place
and the relevant artists saved.</p>
<p>frame_info is a list, with each list entry a collection of artists that
represent what needs to be enabled on each frame. These will be disabled
for other frames.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.FFMpegBase">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">FFMpegBase</tt><aclass="headerlink" href="#matplotlib.animation.FFMpegBase" title="Permalink to this definition">¶</a></dt>
<dd><dlclass="attribute">
<dtid="matplotlib.animation.FFMpegBase.args_key">
<ttclass="descname">args_key</tt><emclass="property"> = u'animation.ffmpeg_args'</em><aclass="headerlink" href="#matplotlib.animation.FFMpegBase.args_key" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="matplotlib.animation.FFMpegBase.exec_key">
<ttclass="descname">exec_key</tt><emclass="property"> = u'animation.ffmpeg_path'</em><aclass="headerlink" href="#matplotlib.animation.FFMpegBase.exec_key" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">output_args</tt><aclass="headerlink" href="#matplotlib.animation.FFMpegBase.output_args" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.FFMpegFileWriter">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">FFMpegFileWriter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.FFMpegFileWriter" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">FileMovieWriter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter" title="Permalink to this definition">¶</a></dt>
<p><aclass="reference internal" href="#matplotlib.animation.MovieWriter" title="matplotlib.animation.MovieWriter"><ttclass="xref py py-obj docutils literal"><spanclass="pre">MovieWriter</span></tt></a> subclass that handles writing to a file.</p>
<ttclass="descname">cleanup</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter.cleanup" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">finish</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter.finish" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">frame_format</tt><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter.frame_format" title="Permalink to this definition">¶</a></dt>
<dd><p>Format (png, jpeg, etc.) to use for saving the frames, which can be
<ttclass="descname">grab_frame</tt><big>(</big><em>**savefig_kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter.grab_frame" title="Permalink to this definition">¶</a></dt>
<dd><p>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’
<ttclass="descname">setup</tt><big>(</big><em>fig</em>, <em>outfile</em>, <em>dpi</em>, <em>frame_prefix=u'_tmp'</em>, <em>clear_temp=True</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.FileMovieWriter.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform setup for writing the movie file.</p>
<ttclass="descname">new_frame_seq</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.FuncAnimation.new_frame_seq" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">new_saved_frame_seq</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.FuncAnimation.new_saved_frame_seq" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.ImageMagickBase">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">ImageMagickBase</tt><aclass="headerlink" href="#matplotlib.animation.ImageMagickBase" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">args_key</tt><emclass="property"> = u'animation.convert_args'</em><aclass="headerlink" href="#matplotlib.animation.ImageMagickBase.args_key" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">exec_key</tt><emclass="property"> = u'animation.convert_path'</em><aclass="headerlink" href="#matplotlib.animation.ImageMagickBase.exec_key" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">output_args</tt><aclass="headerlink" href="#matplotlib.animation.ImageMagickBase.output_args" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">ImageMagickFileWriter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.ImageMagickFileWriter" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">MencoderBase</tt><aclass="headerlink" href="#matplotlib.animation.MencoderBase" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">args_key</tt><emclass="property"> = u'animation.mencoder_args'</em><aclass="headerlink" href="#matplotlib.animation.MencoderBase.args_key" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">exec_key</tt><emclass="property"> = u'animation.mencoder_path'</em><aclass="headerlink" href="#matplotlib.animation.MencoderBase.exec_key" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">output_args</tt><aclass="headerlink" href="#matplotlib.animation.MencoderBase.output_args" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.MencoderFileWriter">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">MencoderFileWriter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MencoderFileWriter" title="Permalink to this definition">¶</a></dt>
<emclass="property">classmethod </em><ttclass="descname">bin_path</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.bin_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the binary path to the commandline tool used by a specific
subclass. This is a class method so that the tool can be looked for
before making a particular MovieWriter subclass available.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.animation.MovieWriter.cleanup">
<ttclass="descname">cleanup</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.cleanup" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean-up and collect the process used to write the movie file.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.animation.MovieWriter.finish">
<ttclass="descname">finish</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.finish" title="Permalink to this definition">¶</a></dt>
<dd><p>Finish any processing for writing the movie.</p>
<ttclass="descname">frame_size</tt><aclass="headerlink" href="#matplotlib.animation.MovieWriter.frame_size" title="Permalink to this definition">¶</a></dt>
<dd><p>A tuple (width,height) in pixels of a movie frame.</p>
<ttclass="descname">grab_frame</tt><big>(</big><em>**savefig_kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.grab_frame" title="Permalink to this definition">¶</a></dt>
<dd><p>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’
<emclass="property">classmethod </em><ttclass="descname">isAvailable</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.isAvailable" title="Permalink to this definition">¶</a></dt>
<dd><p>Check to see if a MovieWriter subclass is actually available by
running the commandline tool.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.animation.MovieWriter.saving">
<ttclass="descname">saving</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.saving" title="Permalink to this definition">¶</a></dt>
<dd><p>Context manager to facilitate writing the movie file.</p>
<p><ttclass="docutils literal"><spanclass="pre">*args</span></tt> are any parameters that should be passed to <aclass="reference internal" href="#matplotlib.animation.MovieWriter.setup" title="matplotlib.animation.MovieWriter.setup"><ttclass="xref py py-obj docutils literal"><spanclass="pre">setup</span></tt></a>.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.animation.MovieWriter.setup">
<ttclass="descname">setup</tt><big>(</big><em>fig</em>, <em>outfile</em>, <em>dpi</em>, <em>*args</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriter.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform setup for writing the movie file.</p>
<dd>The figure object that contains the information for frames</dd>
<dt>outfile: string</dt>
<dd>The filename of the resulting movie file</dd>
<dt>dpi: int</dt>
<dd>The DPI (or resolution) for the file. This controls the size
in pixels of the resulting movie file.</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.MovieWriterRegistry">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">MovieWriterRegistry</tt><aclass="headerlink" href="#matplotlib.animation.MovieWriterRegistry" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">is_available</tt><big>(</big><em>name</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriterRegistry.is_available" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">list</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriterRegistry.list" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">register</tt><big>(</big><em>name</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.MovieWriterRegistry.register" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.animation.TimedAnimation">
<emclass="property">class </em><ttclass="descclassname">matplotlib.animation.</tt><ttclass="descname">TimedAnimation</tt><big>(</big><em>fig</em>, <em>interval=200</em>, <em>repeat_delay=None</em>, <em>repeat=True</em>, <em>event_source=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.animation.TimedAnimation" title="Permalink to this definition">¶</a></dt>