@@ -261,7 +261,7 @@ def set_label_props(self, label, text, color):
261261 label .set_text (text )
262262 label .set_color (color )
263263 label .set_fontproperties (self .labelFontProps )
264- label .set_clip_box (self .ax .bbox )
264+ label .set_clip_box (self .axes .bbox )
265265
266266 def get_text (self , lev , fmt ):
267267 """Get the text of the label."""
@@ -401,7 +401,7 @@ def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5):
401401 return rotation , nlc
402402
403403 def _get_label_text (self , x , y , rotation ):
404- dx , dy = self .ax .transData .inverted ().transform ((x , y ))
404+ dx , dy = self .axes .transData .inverted ().transform ((x , y ))
405405 t = text .Text (dx , dy , rotation = rotation ,
406406 horizontalalignment = 'center' ,
407407 verticalalignment = 'center' , zorder = self ._clabel_zorder )
@@ -412,7 +412,7 @@ def _get_label_clabeltext(self, x, y, rotation):
412412 # the data coordinate and create a label using ClabelText
413413 # class. This way, the rotation of the clabel is along the
414414 # contour line always.
415- transDataInv = self .ax .transData .inverted ()
415+ transDataInv = self .axes .transData .inverted ()
416416 dx , dy = transDataInv .transform ((x , y ))
417417 drotation = transDataInv .transform_angles (np .array ([rotation ]),
418418 np .array ([[x , y ]]))
@@ -432,7 +432,7 @@ def _add_label(self, t, x, y, lev, cvalue):
432432 self .labelXYs .append ((x , y ))
433433
434434 # Add label to plot here - useful for manual mode label selection
435- self .ax .add_artist (t )
435+ self .axes .add_artist (t )
436436
437437 def add_label (self , x , y , rotation , lev , cvalue ):
438438 """
@@ -476,7 +476,7 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
476476 """
477477
478478 if transform is None :
479- transform = self .ax .transData
479+ transform = self .axes .transData
480480
481481 if transform :
482482 x , y = transform .transform ((x , y ))
@@ -495,7 +495,7 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
495495 # grab its vertices
496496 lc = active_path .vertices
497497 # sort out where the new vertex should be added data-units
498- xcmin = self .ax .transData .inverted ().transform ([xmin , ymin ])
498+ xcmin = self .axes .transData .inverted ().transform ([xmin , ymin ])
499499 # if there isn't a vertex close enough
500500 if not np .allclose (xcmin , lc [imin ]):
501501 # insert new data into the vertex list
@@ -511,13 +511,13 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
511511 lc = paths [segmin ].vertices
512512
513513 # In pixel/screen space
514- slc = self .ax .transData .transform (lc )
514+ slc = self .axes .transData .transform (lc )
515515
516516 # Get label width for rotating labels and breaking contours
517517 lw = self .get_label_width (self .labelLevelList [lmin ],
518518 self .labelFmt , self .labelFontSizeList [lmin ])
519519 # lw is in points.
520- lw *= self .ax .figure .dpi / 72.0 # scale to screen coordinates
520+ lw *= self .axes .figure .dpi / 72 # scale to screen coordinates
521521 # now lw in pixels
522522
523523 # Figure out label rotation.
@@ -556,7 +556,7 @@ def labels(self, inline, inline_spacing):
556556 con = self .collections [icon ]
557557 trans = con .get_transform ()
558558 lw = self .get_label_width (lev , self .labelFmt , fsize )
559- lw *= self .ax .figure .dpi / 72.0 # scale to screen coordinates
559+ lw *= self .axes .figure .dpi / 72 # scale to screen coordinates
560560 additions = []
561561 paths = con .get_paths ()
562562 for segNum , linepath in enumerate (paths ):
@@ -773,7 +773,7 @@ def __init__(self, ax, *args,
773773 Keyword arguments are as described in the docstring of
774774 `~.Axes.contour`.
775775 """
776- self .ax = ax
776+ self .axes = ax
777777 self .levels = levels
778778 self .filled = filled
779779 self .linewidths = linewidths
@@ -889,7 +889,7 @@ def __init__(self, ax, *args,
889889 alpha = self .alpha ,
890890 transform = self .get_transform (),
891891 zorder = self ._contour_zorder )
892- self .ax .add_collection (col , autolim = False )
892+ self .axes .add_collection (col , autolim = False )
893893 self .collections .append (col )
894894 else :
895895 tlinewidths = self ._process_linewidths ()
@@ -911,14 +911,14 @@ def __init__(self, ax, *args,
911911 transform = self .get_transform (),
912912 zorder = self ._contour_zorder )
913913 col .set_label ('_nolegend_' )
914- self .ax .add_collection (col , autolim = False )
914+ self .axes .add_collection (col , autolim = False )
915915 self .collections .append (col )
916916
917917 for col in self .collections :
918918 col .sticky_edges .x [:] = [self ._mins [0 ], self ._maxs [0 ]]
919919 col .sticky_edges .y [:] = [self ._mins [1 ], self ._maxs [1 ]]
920- self .ax .update_datalim ([self ._mins , self ._maxs ])
921- self .ax .autoscale_view (tight = True )
920+ self .axes .update_datalim ([self ._mins , self ._maxs ])
921+ self .axes .autoscale_view (tight = True )
922922
923923 self .changed () # set the colors
924924
@@ -927,16 +927,21 @@ def __init__(self, ax, *args,
927927 cbook ._warn_external ('The following kwargs were not used by '
928928 'contour: ' + s )
929929
930+ @cbook .deprecated ("3.3" )
931+ @property
932+ def ax (self ):
933+ return self .axes
934+
930935 def get_transform (self ):
931936 """
932937 Return the :class:`~matplotlib.transforms.Transform`
933938 instance used by this ContourSet.
934939 """
935940 if self ._transform is None :
936- self ._transform = self .ax .transData
941+ self ._transform = self .axes .transData
937942 elif (not isinstance (self ._transform , mtransforms .Transform )
938943 and hasattr (self ._transform , '_as_mpl_transform' )):
939- self ._transform = self ._transform ._as_mpl_transform (self .ax )
944+ self ._transform = self ._transform ._as_mpl_transform (self .axes )
940945 return self ._transform
941946
942947 def __getstate__ (self ):
@@ -1431,9 +1436,9 @@ def _process_args(self, *args, corner_mask=None, **kwargs):
14311436
14321437 # if the transform is not trans data, and some part of it
14331438 # contains transData, transform the xs and ys to data coordinates
1434- if (t != self .ax .transData and
1435- any (t .contains_branch_seperately (self .ax .transData ))):
1436- trans_to_data = t - self .ax .transData
1439+ if (t != self .axes .transData and
1440+ any (t .contains_branch_seperately (self .axes .transData ))):
1441+ trans_to_data = t - self .axes .transData
14371442 pts = np .vstack ([x .flat , y .flat ]).T
14381443 transformed_pts = trans_to_data .transform (pts )
14391444 x = transformed_pts [..., 0 ]
@@ -1498,9 +1503,9 @@ def _check_xyz(self, args, kwargs):
14981503 convert them to 2D using meshgrid.
14991504 """
15001505 x , y = args [:2 ]
1501- kwargs = self .ax ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
1502- x = self .ax .convert_xunits (x )
1503- y = self .ax .convert_yunits (y )
1506+ kwargs = self .axes ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
1507+ x = self .axes .convert_xunits (x )
1508+ y = self .axes .convert_yunits (y )
15041509
15051510 x = np .asarray (x , dtype = np .float64 )
15061511 y = np .asarray (y , dtype = np .float64 )
0 commit comments