@@ -426,6 +426,7 @@ def set_tight_layout(self, tight):
426
426
tight = rcParams ['figure.autolayout' ]
427
427
self ._tight = bool (tight )
428
428
self ._tight_parameters = tight if isinstance (tight , dict ) else {}
429
+ self .stale = True
429
430
430
431
def autofmt_xdate (self , bottom = 0.2 , rotation = 30 , ha = 'right' ):
431
432
"""
@@ -465,6 +466,7 @@ def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
465
466
466
467
if allsubplots :
467
468
self .subplots_adjust (bottom = bottom )
469
+ self .stale = True
468
470
469
471
def get_children (self ):
470
472
'get a list of artists contained in the figure'
@@ -541,6 +543,7 @@ def suptitle(self, t, **kwargs):
541
543
sup .remove ()
542
544
else :
543
545
self ._suptitle = sup
546
+ self .stale = True
544
547
return self ._suptitle
545
548
546
549
def set_canvas (self , canvas ):
@@ -550,6 +553,7 @@ def set_canvas(self, canvas):
550
553
ACCEPTS: a FigureCanvas instance
551
554
"""
552
555
self .canvas = canvas
556
+ self .stale = True
553
557
554
558
def hold (self , b = None ):
555
559
"""
@@ -652,6 +656,7 @@ def figimage(self, X,
652
656
im .set_clim (vmin , vmax )
653
657
self .images .append (im )
654
658
im ._remove_method = lambda h : self .images .remove (h )
659
+ self .stale = True
655
660
return im
656
661
657
662
def set_size_inches (self , * args , ** kwargs ):
@@ -693,6 +698,7 @@ def set_size_inches(self, *args, **kwargs):
693
698
manager = getattr (self .canvas , 'manager' , None )
694
699
if manager is not None :
695
700
manager .resize (int (canvasw ), int (canvash ))
701
+ self .stale = True
696
702
697
703
def get_size_inches (self ):
698
704
"""
@@ -758,6 +764,7 @@ def set_dpi(self, val):
758
764
ACCEPTS: float
759
765
"""
760
766
self .dpi = val
767
+ self .stale = True
761
768
762
769
def set_figwidth (self , val ):
763
770
"""
@@ -766,6 +773,7 @@ def set_figwidth(self, val):
766
773
ACCEPTS: float
767
774
"""
768
775
self .bbox_inches .x1 = val
776
+ self .stale = True
769
777
770
778
def set_figheight (self , val ):
771
779
"""
@@ -774,6 +782,7 @@ def set_figheight(self, val):
774
782
ACCEPTS: float
775
783
"""
776
784
self .bbox_inches .y1 = val
785
+ self .stale = True
777
786
778
787
def set_frameon (self , b ):
779
788
"""
@@ -782,12 +791,14 @@ def set_frameon(self, b):
782
791
ACCEPTS: boolean
783
792
"""
784
793
self .frameon = b
794
+ self .stale = True
785
795
786
796
def delaxes (self , a ):
787
797
'remove a from the figure and update the current axes'
788
798
self ._axstack .remove (a )
789
799
for func in self ._axobservers :
790
800
func (self )
801
+ self .stale = True
791
802
792
803
def _make_key (self , * args , ** kwargs ):
793
804
'make a hashable key out of args and kwargs'
@@ -900,6 +911,7 @@ def add_axes(self, *args, **kwargs):
900
911
901
912
self ._axstack .add (key , a )
902
913
self .sca (a )
914
+ self .stale = True
903
915
return a
904
916
905
917
@docstring .dedent_interpd
@@ -987,6 +999,7 @@ def add_subplot(self, *args, **kwargs):
987
999
988
1000
self ._axstack .add (key , a )
989
1001
self .sca (a )
1002
+ self .stale = True
990
1003
return a
991
1004
992
1005
def clf (self , keep_observers = False ):
@@ -1016,6 +1029,7 @@ def clf(self, keep_observers=False):
1016
1029
if not keep_observers :
1017
1030
self ._axobservers = []
1018
1031
self ._suptitle = None
1032
+ self .stale = True
1019
1033
1020
1034
def clear (self ):
1021
1035
"""
@@ -1227,6 +1241,7 @@ def legend(self, handles, labels, *args, **kwargs):
1227
1241
l = Legend (self , handles , labels , * args , ** kwargs )
1228
1242
self .legends .append (l )
1229
1243
l ._remove_method = lambda h : self .legends .remove (h )
1244
+ self .stale = True
1230
1245
return l
1231
1246
1232
1247
@docstring .dedent_interpd
@@ -1254,6 +1269,7 @@ def text(self, x, y, s, *args, **kwargs):
1254
1269
self ._set_artist_props (t )
1255
1270
self .texts .append (t )
1256
1271
t ._remove_method = lambda h : self .texts .remove (h )
1272
+ self .stale = True
1257
1273
return t
1258
1274
1259
1275
def _set_artist_props (self , a ):
@@ -1399,6 +1415,7 @@ def make_active(event):
1399
1415
self .number = num
1400
1416
1401
1417
plt .draw_if_interactive ()
1418
+ self .stale = True
1402
1419
1403
1420
def add_axobserver (self , func ):
1404
1421
'whenever the axes state change, ``func(self)`` will be called'
@@ -1541,6 +1558,7 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
1541
1558
cb = cbar .colorbar_factory (cax , mappable , ** kw )
1542
1559
1543
1560
self .sca (current_ax )
1561
+ self .stale = True
1544
1562
return cb
1545
1563
1546
1564
def subplots_adjust (self , * args , ** kwargs ):
@@ -1569,6 +1587,7 @@ def subplots_adjust(self, *args, **kwargs):
1569
1587
else :
1570
1588
ax .update_params ()
1571
1589
ax .set_position (ax .figbox )
1590
+ self .stale = True
1572
1591
1573
1592
def ginput (self , n = 1 , timeout = 30 , show_clicks = True , mouse_add = 1 ,
1574
1593
mouse_pop = 3 , mouse_stop = 2 ):
0 commit comments