Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
  • Loading branch information
oscargus and tacaswell committed Oct 21, 2022
1 parent 179f95e commit cb0a6a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions doc/api/animation_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,22 @@ function. ::
from functools import partial

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

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

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

xdata, ydata = [], []
ani = FuncAnimation(
fig, partial(update, x=xdata, y=ydata),
fig, partial(update, ln=line1, x=xdata, y=ydata),
frames=np.linspace(0, 2 * np.pi, 128),
init_func=init, blit=True)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,10 +1533,10 @@ def func(frame, *fargs) -> iterable_of_artists
arguments, set all arguments as keyword arguments, just leaving the
*frame* argument unset::
def func(frame, x, *, y=None):
def func(frame, art, *, y=None):
...
ani = FuncAnimation(fig, partial(func, x=1, y='foo'))
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
Expand Down

0 comments on commit cb0a6a0

Please sign in to comment.