File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -530,15 +530,27 @@ def make_active(event):
530530
531531 _pylab_helpers .Gcf .set_active (figManager )
532532 figManager .canvas .figure .number = num
533+
533534 if _INSTALL_FIG_OBSERVER :
534- def auto_draw (fig ):
535- if fig .stale and matplotlib .is_interactive ():
536- fig .canvas .draw_idle ()
537- figManager .canvas .figure .add_callback (auto_draw )
535+ figManager .canvas .figure .add_callback (_auto_draw_if_interactive )
538536
539537 return figManager .canvas .figure
540538
541539
540+ def _auto_draw_if_interactive (fig ):
541+ """
542+ This is an internal helper function for making sure that auto-redrawing
543+ works as intended in the plain python repl.
544+
545+ Parameters
546+ ----------
547+ fig : Figure
548+ A figure object which is assumed to be associated with a canvas
549+ """
550+ if fig .stale and matplotlib .is_interactive ():
551+ fig .canvas .draw_idle ()
552+
553+
542554def gcf ():
543555 "Get a reference to the current figure."
544556
@@ -548,6 +560,7 @@ def gcf():
548560 else :
549561 return figure ()
550562
563+
551564def fignum_exists (num ):
552565 return _pylab_helpers .Gcf .has_fignum (num ) or num in get_figlabels ()
553566
You can’t perform that action at this time.
0 commit comments