Skip to content

Commit

Permalink
Update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Oct 21, 2022
1 parent 56192f1 commit 22bcf41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion doc/api/animation_api.rst
Expand Up @@ -113,7 +113,6 @@ 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
from functools import partial

fig, ax = plt.subplots()
xdata, ydata = [], []
Expand Down
16 changes: 14 additions & 2 deletions lib/matplotlib/animation.py
Expand Up @@ -1520,12 +1520,24 @@ class FuncAnimation(TimedAnimation):
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.
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, x, *, y=None):
...
ani = FuncAnimation(fig, partial(func, x=1, 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.
Expand Down Expand Up @@ -1565,7 +1577,7 @@ def init_func() -> iterable_of_artists
fargs : tuple or None, optional
Additional arguments to pass to each call to *func*. Note: the use of
`functools.partial` is preferred over *fargs*.
`functools.partial` is preferred over *fargs*. See *func* for details.
save_count : int, default: 100
Fallback for the number of values from *frames* to cache. This is
Expand Down

0 comments on commit 22bcf41

Please sign in to comment.