@@ -815,7 +815,7 @@ def _set_artist_props(self, a):
815815 a .set_transform (self .transData )
816816 a .axes = self
817817
818- def get_axes_patch (self ):
818+ def _gen_axes_patch (self ):
819819 """
820820 Returns the patch used to draw the background of the axes. It
821821 is also used as the clipping path for any data elements on the
@@ -878,24 +878,30 @@ def cla(self):
878878
879879 self ._set_artist_props (self .title )
880880
881- self .axesPatch = self .get_axes_patch ()
882- self .axesPatch .set_figure (self .figure )
883- self .axesPatch .set_facecolor (self ._axisbg )
884- self .axesPatch .set_edgecolor (rcParams ['axes.edgecolor' ])
885- self .axesPatch .set_linewidth (rcParams ['axes.linewidth' ])
886- self .axesPatch .set_transform (self .transAxes )
887-
888- self .axesFrame = self .get_axes_patch ()
889- self .axesFrame .set_figure (self .figure )
890- self .axesFrame .set_facecolor ('none' )
891- self .axesFrame .set_edgecolor (rcParams ['axes.edgecolor' ])
892- self .axesFrame .set_linewidth (rcParams ['axes.linewidth' ])
893- self .axesFrame .set_transform (self .transAxes )
894- self .axesFrame .set_zorder (2.5 )
881+ # the patch draws the background of the axes. we want this to
882+ # be below the other artists; the axesPatch name is deprecated
883+ self .patch = self .axesPatch = self ._gen_axes_patch ()
884+ self .patch .set_figure (self .figure )
885+ self .patch .set_facecolor (self ._axisbg )
886+ self .patch .set_edgecolor (rcParams ['axes.edgecolor' ])
887+ self .patch .set_linewidth (rcParams ['axes.linewidth' ])
888+ self .patch .set_transform (self .transAxes )
889+
890+ # the frame draws the border around the axes and we want this
891+ # above. this is a place holder for a more sophisticated
892+ # artist that might just draw a left, bottom frame, or a
893+ # centered frame, etc the axesFrame name is deprecated
894+ self .frame = self .axesFrame = self ._gen_axes_patch ()
895+ self .frame .set_figure (self .figure )
896+ self .frame .set_facecolor ('none' )
897+ self .frame .set_edgecolor (rcParams ['axes.edgecolor' ])
898+ self .frame .set_linewidth (rcParams ['axes.linewidth' ])
899+ self .frame .set_transform (self .transAxes )
900+ self .frame .set_zorder (2.5 )
895901 self .axison = True
896902
897- self .xaxis .set_clip_path (self .axesPatch )
898- self .yaxis .set_clip_path (self .axesPatch )
903+ self .xaxis .set_clip_path (self .patch )
904+ self .yaxis .set_clip_path (self .patch )
899905
900906
901907 def clear (self ):
@@ -1211,7 +1217,8 @@ def get_child_artists(self):
12111217
12121218 def get_frame (self ):
12131219 'Return the axes Rectangle frame'
1214- return self .axesPatch
1220+ warnings .warn ('use ax.patch instead' , DeprecationWarning )
1221+ return self .patch
12151222
12161223 def get_legend (self ):
12171224 'Return the legend.Legend instance, or None if no legend is defined'
@@ -1271,7 +1278,7 @@ def add_artist(self, a):
12711278 a .set_axes (self )
12721279 self .artists .append (a )
12731280 self ._set_artist_props (a )
1274- a .set_clip_path (self .axesPatch )
1281+ a .set_clip_path (self .patch )
12751282 a ._remove_method = lambda h : self .artists .remove (h )
12761283
12771284 def add_collection (self , collection , autolim = True ):
@@ -1284,7 +1291,7 @@ def add_collection(self, collection, autolim=True):
12841291 collection .set_label ('collection%d' % len (self .collections ))
12851292 self .collections .append (collection )
12861293 self ._set_artist_props (collection )
1287- collection .set_clip_path (self .axesPatch )
1294+ collection .set_clip_path (self .patch )
12881295 if autolim :
12891296 if collection ._paths and len (collection ._paths ):
12901297 self .update_datalim (collection .get_datalim (self .transData ))
@@ -1296,7 +1303,7 @@ def add_line(self, line):
12961303 lines
12971304 '''
12981305 self ._set_artist_props (line )
1299- line .set_clip_path (self .axesPatch )
1306+ line .set_clip_path (self .patch )
13001307
13011308 self ._update_line_limits (line )
13021309 if not line .get_label ():
@@ -1317,7 +1324,7 @@ def add_patch(self, p):
13171324 """
13181325
13191326 self ._set_artist_props (p )
1320- p .set_clip_path (self .axesPatch )
1327+ p .set_clip_path (self .patch )
13211328 self ._update_patch_limits (p )
13221329 self .patches .append (p )
13231330 p ._remove_method = lambda h : self .patches .remove (h )
@@ -1345,7 +1352,7 @@ def add_table(self, tab):
13451352 '''
13461353 self ._set_artist_props (tab )
13471354 self .tables .append (tab )
1348- tab .set_clip_path (self .axesPatch )
1355+ tab .set_clip_path (self .patch )
13491356 tab ._remove_method = lambda h : self .tables .remove (h )
13501357
13511358 def relim (self ):
@@ -1419,7 +1426,7 @@ def in_axes(self, mouseevent):
14191426 return *True* if the given *mouseevent* (in display coords)
14201427 is in the Axes
14211428 '''
1422- return self .axesPatch .contains (mouseevent )[0 ]
1429+ return self .patch .contains (mouseevent )[0 ]
14231430
14241431 def get_autoscale_on (self ):
14251432 """
@@ -1475,7 +1482,7 @@ def draw(self, renderer=None, inframe=False):
14751482 self .apply_aspect (self .get_position (True ))
14761483
14771484 if self .axison and self ._frameon :
1478- self .axesPatch .draw (renderer )
1485+ self .patch .draw (renderer )
14791486
14801487 artists = []
14811488
@@ -1508,8 +1515,8 @@ def draw(self, renderer=None, inframe=False):
15081515 # respect z-order for now
15091516 renderer .draw_image (
15101517 round (l ), round (b ), im , self .bbox ,
1511- self .axesPatch .get_path (),
1512- self .axesPatch .get_transform ())
1518+ self .patch .get_path (),
1519+ self .patch .get_transform ())
15131520
15141521 artists .extend (self .collections )
15151522 artists .extend (self .patches )
@@ -1529,7 +1536,7 @@ def draw(self, renderer=None, inframe=False):
15291536 if self .legend_ is not None :
15301537 artists .append (self .legend_ )
15311538 if self .axison and self ._frameon :
1532- artists .append (self .axesFrame )
1539+ artists .append (self .frame )
15331540
15341541 dsu = [ (a .zorder , i , a ) for i , a in enumerate (artists )
15351542 if not a .get_animated () ]
@@ -1696,7 +1703,7 @@ def set_axis_bgcolor(self, color):
16961703 """
16971704
16981705 self ._axisbg = color
1699- self .axesPatch .set_facecolor (color )
1706+ self .patch .set_facecolor (color )
17001707
17011708 ### data limits, ticks, tick labels, and formatting
17021709
@@ -2364,8 +2371,8 @@ def get_children(self):
23642371 children .append (self .legend_ )
23652372 children .extend (self .collections )
23662373 children .append (self .title )
2367- children .append (self .axesPatch )
2368- children .append (self .axesFrame )
2374+ children .append (self .patch )
2375+ children .append (self .frame )
23692376 return children
23702377
23712378 def contains (self ,mouseevent ):
@@ -2375,7 +2382,7 @@ def contains(self,mouseevent):
23752382 """
23762383 if callable (self ._contains ): return self ._contains (self ,mouseevent )
23772384
2378- inside = self .axesPatch .contains (mouseevent .x , mouseevent .y )
2385+ inside = self .patch .contains (mouseevent .x , mouseevent .y )
23792386 return inside ,{}
23802387
23812388 def pick (self , * args ):
@@ -2647,7 +2654,7 @@ def annotate(self, *args, **kwargs):
26472654 a = mtext .Annotation (* args , ** kwargs )
26482655 a .set_transform (mtransforms .IdentityTransform ())
26492656 self ._set_artist_props (a )
2650- if kwargs .has_key ('clip_on' ): a .set_clip_path (self .axesPatch )
2657+ if kwargs .has_key ('clip_on' ): a .set_clip_path (self .patch )
26512658 self .texts .append (a )
26522659 return a
26532660 annotate .__doc__ = cbook .dedent (annotate .__doc__ ) % martist .kwdocd
@@ -5342,7 +5349,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
53425349 im .set_data (X )
53435350 im .set_alpha (alpha )
53445351 self ._set_artist_props (im )
5345- im .set_clip_path (self .axesPatch )
5352+ im .set_clip_path (self .patch )
53465353 #if norm is None and shape is None:
53475354 # im.set_clim(vmin, vmax)
53485355 if vmin is not None or vmax is not None :
0 commit comments