File tree 1 file changed +17
-4
lines changed 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -530,15 +530,27 @@ def make_active(event):
530
530
531
531
_pylab_helpers .Gcf .set_active (figManager )
532
532
figManager .canvas .figure .number = num
533
+
533
534
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 )
538
536
539
537
return figManager .canvas .figure
540
538
541
539
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
+
542
554
def gcf ():
543
555
"Get a reference to the current figure."
544
556
@@ -548,6 +560,7 @@ def gcf():
548
560
else :
549
561
return figure ()
550
562
563
+
551
564
def fignum_exists (num ):
552
565
return _pylab_helpers .Gcf .has_fignum (num ) or num in get_figlabels ()
553
566
You can’t perform that action at this time.
0 commit comments