@@ -115,7 +115,7 @@ def __call__(self, ax, renderer):
115
115
# time as transSubfigure may otherwise change after this is evaluated.
116
116
return mtransforms .TransformedBbox (
117
117
mtransforms .Bbox .from_bounds (* self ._bounds ),
118
- self ._transform - ax .figure .transSubfigure )
118
+ self ._transform - ax ._figure .transSubfigure )
119
119
120
120
121
121
def _process_plot_format (fmt , * , ambiguous_fmt_datakey = False ):
@@ -787,7 +787,7 @@ def get_subplotspec(self):
787
787
def set_subplotspec (self , subplotspec ):
788
788
"""Set the `.SubplotSpec`. associated with the subplot."""
789
789
self ._subplotspec = subplotspec
790
- self ._set_position (subplotspec .get_position (self .figure ))
790
+ self ._set_position (subplotspec .get_position (self ._figure ))
791
791
792
792
def get_gridspec (self ):
793
793
"""Return the `.GridSpec` associated with the subplot, or None."""
@@ -959,7 +959,7 @@ def get_xaxis_text1_transform(self, pad_points):
959
959
labels_align = mpl .rcParams ["xtick.alignment" ]
960
960
return (self .get_xaxis_transform (which = 'tick1' ) +
961
961
mtransforms .ScaledTranslation (0 , - 1 * pad_points / 72 ,
962
- self .figure .dpi_scale_trans ),
962
+ self ._figure .dpi_scale_trans ),
963
963
"top" , labels_align )
964
964
965
965
def get_xaxis_text2_transform (self , pad_points ):
@@ -985,7 +985,7 @@ def get_xaxis_text2_transform(self, pad_points):
985
985
labels_align = mpl .rcParams ["xtick.alignment" ]
986
986
return (self .get_xaxis_transform (which = 'tick2' ) +
987
987
mtransforms .ScaledTranslation (0 , pad_points / 72 ,
988
- self .figure .dpi_scale_trans ),
988
+ self ._figure .dpi_scale_trans ),
989
989
"bottom" , labels_align )
990
990
991
991
def get_yaxis_transform (self , which = 'grid' ):
@@ -1039,7 +1039,7 @@ def get_yaxis_text1_transform(self, pad_points):
1039
1039
labels_align = mpl .rcParams ["ytick.alignment" ]
1040
1040
return (self .get_yaxis_transform (which = 'tick1' ) +
1041
1041
mtransforms .ScaledTranslation (- 1 * pad_points / 72 , 0 ,
1042
- self .figure .dpi_scale_trans ),
1042
+ self ._figure .dpi_scale_trans ),
1043
1043
labels_align , "right" )
1044
1044
1045
1045
def get_yaxis_text2_transform (self , pad_points ):
@@ -1065,7 +1065,7 @@ def get_yaxis_text2_transform(self, pad_points):
1065
1065
labels_align = mpl .rcParams ["ytick.alignment" ]
1066
1066
return (self .get_yaxis_transform (which = 'tick2' ) +
1067
1067
mtransforms .ScaledTranslation (pad_points / 72 , 0 ,
1068
- self .figure .dpi_scale_trans ),
1068
+ self ._figure .dpi_scale_trans ),
1069
1069
labels_align , "left" )
1070
1070
1071
1071
def _update_transScale (self ):
@@ -1172,7 +1172,7 @@ def get_axes_locator(self):
1172
1172
1173
1173
def _set_artist_props (self , a ):
1174
1174
"""Set the boilerplate props for artists added to Axes."""
1175
- a .set_figure (self .figure )
1175
+ a .set_figure (self ._figure )
1176
1176
if not a .is_transform_set ():
1177
1177
a .set_transform (self .transData )
1178
1178
@@ -1295,7 +1295,7 @@ def __clear(self):
1295
1295
self ._gridOn = mpl .rcParams ['axes.grid' ]
1296
1296
old_children , self ._children = self ._children , []
1297
1297
for chld in old_children :
1298
- chld .axes = chld .figure = None
1298
+ chld .axes = chld ._figure = None
1299
1299
self ._mouseover_set = _OrderedSet ()
1300
1300
self .child_axes = []
1301
1301
self ._current_image = None # strictly for pyplot via _sci, _gci
@@ -1346,7 +1346,7 @@ def __clear(self):
1346
1346
# the other artists. We use the frame to draw the edges so we are
1347
1347
# setting the edgecolor to None.
1348
1348
self .patch = self ._gen_axes_patch ()
1349
- self .patch .set_figure (self .figure )
1349
+ self .patch .set_figure (self ._figure )
1350
1350
self .patch .set_facecolor (self ._facecolor )
1351
1351
self .patch .set_edgecolor ('none' )
1352
1352
self .patch .set_linewidth (0 )
@@ -1521,7 +1521,7 @@ def _set_title_offset_trans(self, title_offset_points):
1521
1521
"""
1522
1522
self .titleOffsetTrans = mtransforms .ScaledTranslation (
1523
1523
0.0 , title_offset_points / 72 ,
1524
- self .figure .dpi_scale_trans )
1524
+ self ._figure .dpi_scale_trans )
1525
1525
for _title in (self .title , self ._left_title , self ._right_title ):
1526
1526
_title .set_transform (self .transAxes + self .titleOffsetTrans )
1527
1527
_title .set_clip_box (None )
@@ -2246,7 +2246,7 @@ def add_child_axes(self, ax):
2246
2246
2247
2247
self .child_axes .append (ax )
2248
2248
ax ._remove_method = functools .partial (
2249
- self .figure ._remove_axes , owners = [self .child_axes ])
2249
+ self ._figure ._remove_axes , owners = [self .child_axes ])
2250
2250
self .stale = True
2251
2251
return ax
2252
2252
@@ -2990,7 +2990,7 @@ def _update_title_position(self, renderer):
2990
2990
axs = set ()
2991
2991
axs .update (self .child_axes )
2992
2992
axs .update (self ._twinned_axes .get_siblings (self ))
2993
- axs .update (self .figure ._align_label_groups ['title' ].get_siblings (self ))
2993
+ axs .update (self ._figure ._align_label_groups ['title' ].get_siblings (self ))
2994
2994
2995
2995
for ax in self .child_axes : # Child positions must be updated first.
2996
2996
locator = ax .get_axes_locator ()
@@ -3076,7 +3076,7 @@ def draw(self, renderer):
3076
3076
for _axis in self ._axis_map .values ():
3077
3077
artists .remove (_axis )
3078
3078
3079
- if not self .figure .canvas .is_saving ():
3079
+ if not self ._figure .canvas .is_saving ():
3080
3080
artists = [
3081
3081
a for a in artists
3082
3082
if not a .get_animated () or isinstance (a , mimage .AxesImage )]
@@ -3104,10 +3104,10 @@ def draw(self, renderer):
3104
3104
artists = [self .patch ] + artists
3105
3105
3106
3106
if artists_rasterized :
3107
- _draw_rasterized (self .figure , artists_rasterized , renderer )
3107
+ _draw_rasterized (self ._figure , artists_rasterized , renderer )
3108
3108
3109
3109
mimage ._draw_list_compositing_images (
3110
- renderer , self , artists , self .figure .suppressComposite )
3110
+ renderer , self , artists , self ._figure .suppressComposite )
3111
3111
3112
3112
renderer .close_group ('axes' )
3113
3113
self .stale = False
@@ -3116,7 +3116,7 @@ def draw_artist(self, a):
3116
3116
"""
3117
3117
Efficiently redraw a single artist.
3118
3118
"""
3119
- a .draw (self .figure .canvas .get_renderer ())
3119
+ a .draw (self ._figure .canvas .get_renderer ())
3120
3120
3121
3121
def redraw_in_frame (self ):
3122
3122
"""
@@ -3126,7 +3126,7 @@ def redraw_in_frame(self):
3126
3126
for artist in [* self ._axis_map .values (),
3127
3127
self .title , self ._left_title , self ._right_title ]:
3128
3128
stack .enter_context (artist ._cm_set (visible = False ))
3129
- self .draw (self .figure .canvas .get_renderer ())
3129
+ self .draw (self ._figure .canvas .get_renderer ())
3130
3130
3131
3131
# Axes rectangle characteristics
3132
3132
@@ -3988,7 +3988,7 @@ def format_coord(self, x, y):
3988
3988
"???" if y is None else self .format_ydata (y ))
3989
3989
screen_xy = self .transData .transform ((x , y ))
3990
3990
xy_strs = []
3991
- # Retrieve twins in the order of self.figure .axes to sort tied zorders (which is
3991
+ # Retrieve twins in the order of self._figure .axes to sort tied zorders (which is
3992
3992
# the common case) by the order in which they are added to the figure.
3993
3993
for ax in sorted (twins , key = attrgetter ("zorder" )):
3994
3994
data_x , data_y = ax .transData .inverted ().transform (screen_xy )
@@ -4434,7 +4434,7 @@ def get_tightbbox(self, renderer=None, call_axes_locator=True,
4434
4434
4435
4435
bb = []
4436
4436
if renderer is None :
4437
- renderer = self .figure ._get_renderer ()
4437
+ renderer = self ._figure ._get_renderer ()
4438
4438
4439
4439
if not self .get_visible ():
4440
4440
return None
@@ -4485,9 +4485,9 @@ def _make_twin_axes(self, *args, **kwargs):
4485
4485
raise ValueError ("Twinned Axes may share only one axis" )
4486
4486
ss = self .get_subplotspec ()
4487
4487
if ss :
4488
- twin = self .figure .add_subplot (ss , * args , ** kwargs )
4488
+ twin = self ._figure .add_subplot (ss , * args , ** kwargs )
4489
4489
else :
4490
- twin = self .figure .add_axes (
4490
+ twin = self ._figure .add_axes (
4491
4491
self .get_position (True ), * args , ** kwargs ,
4492
4492
axes_locator = _TransformedBoundsLocator (
4493
4493
[0 , 0 , 1 , 1 ], self .transAxes ))
@@ -4713,7 +4713,7 @@ def get_agg_filter(self):
4713
4713
return None
4714
4714
4715
4715
def __init__ (self , figure , artists ):
4716
- self .figure = figure
4716
+ self ._figure = figure
4717
4717
self .artists = artists
4718
4718
4719
4719
@martist .allow_rasterization
0 commit comments