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

Skip to content

Commit e6be6b0

Browse files
committed
MNT: don't trigger draw idle if canvas is saving
1 parent 67beb95 commit e6be6b0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ def __init__(self, figure):
16851685
# - in interactive mode
16861686
# - not bunching `draw_idle` calls (ex not in IPython)
16871687
self._is_idle_drawing = True
1688-
1688+
self._is_saving = False
16891689
figure.set_canvas(self)
16901690
self.figure = figure
16911691
# a dictionary from event name to a dictionary that maps cid->func
@@ -1698,7 +1698,6 @@ def __init__(self, figure):
16981698
self.scroll_pick_id = self.mpl_connect('scroll_event', self.pick)
16991699
self.mouse_grabber = None # the axes currently grabbing mouse
17001700
self.toolbar = None # NavigationToolbar2 will set me
1701-
self._is_saving = False
17021701
self._is_idle_drawing = False
17031702

17041703
@contextmanager

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def _auto_draw_if_interactive(fig, val):
564564
fig : Figure
565565
A figure object which is assumed to be associated with a canvas
566566
"""
567-
if val and matplotlib.is_interactive():
567+
if val and matplotlib.is_interactive() and not fig.canvas.is_saving():
568568
fig.canvas.draw_idle()
569569

570570

0 commit comments

Comments
 (0)