8000 MNT: make sorting out what to re-draw faster · matplotlib/matplotlib@83ea020 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83ea020

Browse files
committed
MNT: make sorting out what to re-draw faster
Look at figures, not axes, and use a set
1 parent 13e7c09 commit 83ea020

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/matplotlib/animation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -971,17 +971,18 @@ def __init__(self, fig, artists, *args, **kwargs):
971971

972972
def _init_draw(self):
973973
# Make all the artists involved in *any* frame invisible
974-
axes = []
974+
figs = set()
975975
for f in self.new_frame_seq():
976976
for artist in f:
977977
artist.set_visible(False)
978+
artist.set_animated(True)
978979
# Assemble a list of unique axes that need flushing
979-
if artist.axes not in axes:
980-
axes.append(artist.axes)
980+
if artist.axes.figure not in figs:
981+
figs.add(artist.axes.figure)
981982

982983
# Flush the needed axes
983-
for ax in axes:
984-
ax.figure.canvas.draw()
984+
for fig in figs:
985+
fig.canvas.draw()
985986

986987
def _pre_draw(self, framedata, blit):
987988
'''

0 commit comments

Comments
 (0)
0