Skip to content

Commit 3389ed7

Browse files
author
pkienzle
committed
dynamic_collection: collection now has private copy of array
svn path=/trunk/matplotlib/; revision=5848
1 parent fee8218 commit 3389ed7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/animation/dynamic_collection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ def onpress(event):
3434
color = cm.jet(rand())
3535
offsets.append((x,y))
3636
facecolors.append(color)
37+
collection.set_offsets(offsets)
38+
collection.set_facecolors(facecolors)
3739
fig.canvas.draw()
3840
elif event.key=='d':
3941
N = len(offsets)
4042
if N>0:
4143
ind = random.randint(0,N-1)
4244
offsets.pop(ind)
4345
facecolors.pop(ind)
46+
collection.set_offsets(offsets)
47+
collection.set_facecolors(facecolors)
4448
fig.canvas.draw()
4549

4650
fig.canvas.mpl_connect('key_press_event', onpress)

0 commit comments

Comments
 (0)