| [ Web Proxy ] |
| Viewing: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.animation.FuncAnimation.html | [Back] [Original] |
Section Navigation
matplotlibmatplotlib.animationmatplotlib.artistmatplotlib.axesmatplotlib.axismatplotlib.backend_basesmatplotlib.backend_managersmatplotlib.backend_toolsmatplotlib.backendsmatplotlib.backends.backend_mixedmatplotlib.backends.backend_templatematplotlib.backends.backend_aggmatplotlib.backends.backend_cairomatplotlib.backends.backend_gtk3agg, matplotlib.backends.backend_gtk3cairomatplotlib.backends.backend_gtk4agg, matplotlib.backends.backend_gtk4cairomatplotlib.backends.backend_nbaggmatplotlib.backends.backend_pdfmatplotlib.backends.backend_pgfmatplotlib.backends.backend_psmatplotlib.backends.registrymatplotlib.backends.backend_qtagg, matplotlib.backends.backend_qtcairomatplotlib.backends.backend_svgmatplotlib.backends.backend_tkagg, matplotlib.backends.backend_tkcairomatplotlib.backends.backend_webagg_corematplotlib.backends.backend_webaggmatplotlib.backends.backend_wxagg, matplotlib.backends.backend_wxcairomatplotlib.beziermatplotlib.categorymatplotlib.cbookmatplotlib.cmmatplotlib.collectionsmatplotlib.colorbarmatplotlib.colorizermatplotlib.colorsmatplotlib.containermatplotlib.contourmatplotlib.datesmatplotlib.dvireadmatplotlib.figurematplotlib.font_managermatplotlib.ft2fontmatplotlib.gridspec
matplotlib.hatchmatplotlib.imagematplotlib.insetmatplotlib.layout_enginematplotlib.legendmatplotlib.legend_handlermatplotlib.lines
matplotlib.markers
matplotlib.mathtextmatplotlib.mlabmatplotlib.offsetboxmatplotlib.patchesmatplotlib.pathmatplotlib.patheffectsmatplotlib.pyplotmatplotlib.projections
matplotlib.quiver
matplotlib.rcsetupmatplotlib.sankeymatplotlib.scalematplotlib.sphinxext.mathmplmatplotlib.sphinxext.plot_directivematplotlib.sphinxext.figmpl_directivematplotlib.sphinxext.rolesmatplotlib.spinesmatplotlib.stylematplotlib.tablematplotlib.testingmatplotlib.textmatplotlib.texmanagermatplotlib.tickermatplotlib.transformsmatplotlib.trimatplotlib.typingmatplotlib.unitsmatplotlib.widgetsmatplotlib._afmmatplotlib._apimatplotlib._docstringmatplotlib._enumsmatplotlib._type1fontmatplotlib._tight_bboxmatplotlib._tight_layoutmpl_toolkits.mplot3dmpl_toolkits.axes_grid1mpl_toolkits.axisartistpylabmatplotlib.animationTimedAnimation subclass that 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.
FigureThe figure object used to get needed events, such as draw or resize.
The function to call at each frame. The first argument will
be the next value in frames. Any additional positional
arguments can be supplied using functools.partial or via the fargs
parameter.
The required signature is:
def func(frame, *fargs) -> iterable_of_artists
It is often more convenient to provide the arguments using
functools.partial. In this way it is also possible to pass keyword
arguments. To pass a function with both positional and keyword
arguments, set all arguments as keyword arguments, just leaving the
frame argument unset:
def func(frame, art, *, y=None):
...
ani = FuncAnimation(fig, partial(func, art=ln, y='foo'))
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.
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.
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.
Additional arguments to pass to each call to func. Note: the use of
functools.partial is preferred over fargs. See func for details.
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.
Delay between frames in milliseconds.
The delay in milliseconds between consecutive animation runs, if repeat is True.
Whether the animation repeats when the sequence of frames is completed.
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.
Whether frame data is cached. Disabling cache might be helpful when frames contain large objects.
Methods
|
|
Return a new sequence of frame information. |
|
Return a new sequence of saved/cached frame information. |
|
|
Pause the animation. |
|
Resume the animation. |
|
Save the animation as a movie file by drawing every frame. |
|
Convert the animation to an HTML5 |
|
Generate HTML representation of the animation. |
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-809-gd7a19fbf4.
Built with the PyData Sphinx Theme 0.18.0.
| Web Proxy Viewer | New URL | Original Page |