@@ -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
@@ -666,33 +666,27 @@ def clf():
666666
667667
668668def draw ():
669- """
670- Redraw the current figure.
669+ """Redraw the current figure.
671670
672- This is used in interactive mode to update a figure that
673- has been altered using one or more plot object method calls;
674- it is not needed if figure modification is done entirely
675- with pyplot functions, if a sequence of modifications ends
676- with a pyplot function, or if matplotlib is in non-interactive
677- mode and the sequence of modifications ends with :func:`show` or
678- :func:`savefig`.
671+ This is used in interactive mode to update a figure that has been
672+ altered, but not automatically re-drawn. This should be only rarely
673+ needed, but there may be ways to modify the state of a figure with
674+ out marking it as `stale`. Please report these cases as bugs.
679675
680676 A more object-oriented alternative, given any
681677 :class:`~matplotlib.figure.Figure` instance, :attr:`fig`, that
682678 was created using a :mod:`~matplotlib.pyplot` function, is::
683679
684- fig.canvas.draw()
685-
686-
680+ fig.canvas.draw_idle()
687681 """
688- get_current_fig_manager ().canvas .draw ()
682+ get_current_fig_manager ().canvas .draw_idle ()
689683
690684
691685@docstring .copy_dedent (Figure .savefig )
692686def savefig (* args , ** kwargs ):
693687 fig = gcf ()
694688 res = fig .savefig (* args , ** kwargs )
695- draw () # need this if 'transparent=True' to reset colors
689+ fig . canvas . draw_idle () # need this if 'transparent=True' to reset colors
696690 return res
697691
698692
0 commit comments