Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb0a6a0

Browse files
oscargustacaswell
andauthored
Apply suggestions from code review
Co-authored-by: Thomas A Caswell <[email protected]>
1 parent 179f95e commit cb0a6a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/api/animation_api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,22 @@ function. ::
142142
from functools import partial
143143

144144
fig, ax = plt.subplots()
145-
ln, = plt.plot([], [], 'ro')
145+
line1, = plt.plot([], [], 'ro')
146146

147147
def init():
148148
ax.set_xlim(0, 2*np.pi)
149149
ax.set_ylim(-1, 1)
150150
return ln,
151151

152-
def update(frame, x, y):
152+
def update(frame, ln, x, y):
153153
x.append(frame)
154154
y.append(np.sin(frame))
155155
ln.set_data(xdata, ydata)
156156
return ln,
157157

158158
xdata, ydata = [], []
159159
ani = FuncAnimation(
160-
fig, partial(update, x=xdata, y=ydata),
160+
fig, partial(update, ln=line1, x=xdata, y=ydata),
161161
frames=np.linspace(0, 2 * np.pi, 128),
162162
init_func=init, blit=True)
163163

lib/matplotlib/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,10 +1533,10 @@ def func(frame, *fargs) -> iterable_of_artists
15331533
arguments, set all arguments as keyword arguments, just leaving the
15341534
*frame* argument unset::
15351535
1536-
def func(frame, x, *, y=None):
1536+
def func(frame, art, *, y=None):
15371537
...
15381538
1539-
ani = FuncAnimation(fig, partial(func, x=1, y='foo'))
1539+
ani = FuncAnimation(fig, partial(func, art=ln, y='foo'))
15401540
15411541
If ``blit == True``, *func* must return an iterable of all artists
15421542
that were modified or created. This information is used by the blitting

0 commit comments

Comments
 (0)