### Navigation

- index
- modules |
- next |
- previous |
- home|
- examples|
- tutorials|
- pyplot|
- docs »
- The Matplotlib API »
- `animation` module »

# matplotlib.animation.FuncAnimation

class `matplotlib.animation.``FuncAnimation`(fig, func, frames=None, init_func=None, fargs=None, save_count=None, **kwargs)

  Makes an animation by repeatedly calling a function `func`.

  > Parameters: | fig : matplotlib.figure.Figure The figure object that is used to get draw, resize, and any other needed events. func : callable 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(fr: object, *fargs) -> iterable_of_artists:
  > frames : iterable, 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, equivalent to passing `range(frames)` If a generator function, then must have the signature
  >     def gen_function() -> obj:
  > 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. If `None`, then equivalent to passing `itertools.count`. init_func : callable, 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. If blit=True, `init_func` must return an iterable of artists to be re-drawn. The required signature is
  >     def init_func() -> iterable_of_artists:
  fargs : tuple or None, optional Additional arguments to pass to each call to `func` save_count : int, optional The number of values from `frames` to cache. interval : number, optional Delay between frames in milliseconds. Defaults to 200. repeat_delay : number, optional If the animation in repeated, adds a delay in milliseconds before repeating the animation. Defaults to `None`. repeat : bool, optional Controls whether the animation should repeat when the sequence of frames is completed. Defaults to `True`. blit : bool, optional Controls whether blitting is used to optimize drawing. Defaults to `False`.

  `__init__`(fig, func, frames=None, init_func=None, fargs=None, save_count=None, **kwargs)