Skip to content

Commit b8d621a

Browse files
committed
Fix partial example
1 parent cb0a6a0 commit b8d621a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/animation_api.rst

Lines changed: 4 additions & 4 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-
line1, = plt.plot([], [], 'ro')
145+
line1, = ax.plot([], [], 'ro')
146146

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

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

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

0 commit comments

Comments
 (0)