@@ -488,13 +488,9 @@ def __init__(self, fig, rect,
488488 self ._sharey = sharey
489489 if sharex is not None :
490490 self ._shared_x_axes .join (self , sharex )
491- if sharey is not None :
491+ if sharey is not None :
492492 self ._shared_y_axes .join (self , sharey )
493- # Flag: True if some other Axes instance is sharing our x or y axis
494- self ._masterx = False
495- self ._mastery = False
496- if sharex : sharex ._masterx = True
497- if sharey : sharey ._mastery = True
493+
498494 self .set_label (label )
499495 self .set_figure (fig )
500496
@@ -822,7 +818,8 @@ def apply_aspect(self):
822818 Use self._aspect and self._adjustable to modify the
823819 axes box or the view limits.
824820 '''
825-
821+ #MGDTODO: Numpify
822+
826823 if self ._aspect == 'auto' :
827824 self .set_position ( self ._originalPosition , 'active' )
828825 return
@@ -834,7 +831,7 @@ def apply_aspect(self):
834831
835832 #Ensure at drawing time that any Axes involved in axis-sharing
836833 # does not have its position changed.
837- if self . _masterx or self ._mastery or self . _sharex or self ._sharey :
834+ if self in self ._shared_x_axes or self in self ._shared_y_axes :
838835 self ._adjustable = 'datalim'
839836
840837 figW ,figH = self .get_figure ().get_size_inches ()
@@ -847,6 +844,11 @@ def apply_aspect(self):
847844 return
848845
849846
847+ xmin ,xmax = self .get_xlim ()
848+ xsize = max (math .fabs (xmax - xmin ), 1e-30 )
849+ ymin ,ymax = self .get_ylim ()
850+ ysize = max (math .fabs (ymax - ymin ), 1e-30 )
851+
850852 l ,b ,w ,h = self .get_position (original = True ).bounds
851853 box_aspect = fig_aspect * (h / w )
852854 data_ratio = box_aspect / A
@@ -858,8 +860,8 @@ def apply_aspect(self):
858860 #print 'good enough already'
859861 return
860862 dL = self .dataLim
861- xr = 1.05 * dL .width ()
862- yr = 1.05 * dL .height ()
863+ xr = 1.05 * dL .width
864+ yr = 1.05 * dL .height
863865 xmarg = xsize - xr
864866 ymarg = ysize - yr
865867 Ysize = data_ratio * xsize
@@ -871,10 +873,10 @@ def apply_aspect(self):
871873 #print 'xmin, xmax, ymin, ymax', xmin, xmax, ymin, ymax
872874 #print 'xsize, Xsize, ysize, Ysize', xsize, Xsize, ysize, Ysize
873875
874- changex = (( self . _sharey or self ._mastery ) and not
875- ( self ._sharex or self . _masterx ) )
876- changey = (( self . _sharex or self ._masterx ) and not
877- ( self ._sharey or self . _mastery ) )
876+ changex = (self in self ._shared_y_axes
877+ and self not in self ._shared_x_axes )
878+ changey = (self in self ._shared_x_axes
879+ and self not in self ._shared_y_axes )
878880 if changex and changey :
879881 warnings .warn ("adjustable='datalim' cannot work with shared x and y axes" )
880882 return
@@ -2200,7 +2202,8 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
22002202 %(Line2D)s
22012203 """
22022204
2203- trans = mtransforms .blend_xy_sep_transform (self .transAxes , self .transData )
2205+ trans = mtransforms .blended_transform_factory (
2206+ self .transAxes , self .transData )
22042207 l , = self .plot ([xmin ,xmax ], [y ,y ], transform = trans , scalex = False , ** kwargs )
22052208 return l
22062209
@@ -2236,7 +2239,8 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
22362239 %(Line2D)s
22372240 """
22382241
2239- trans = mtransforms .blend_xy_sep_transform ( self .transData , self .transAxes )
2242+ trans = mtransforms .blended_transform_factory (
2243+ self .transData , self .transAxes )
22402244 l , = self .plot ([x ,x ], [ymin ,ymax ] , transform = trans , scaley = False , ** kwargs )
22412245 return l
22422246
@@ -2275,7 +2279,8 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
22752279 %(Polygon)s
22762280 """
22772281 # convert y axis units
2278- trans = mtransforms .blend_xy_sep_transform ( self .transAxes , self .transData )
2282+ trans = mtransforms .blended_transform_factory (
2283+ self .transAxes , self .transData )
22792284 verts = (xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )
22802285 p = mpatches .Polygon (verts , ** kwargs )
22812286 p .set_transform (trans )
@@ -2315,7 +2320,8 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
23152320 %(Polygon)s
23162321 """
23172322 # convert x axis units
2318- trans = mtransforms .blend_xy_sep_transform (self .transData , self .transAxes )
2323+ trans = mtransforms .blended_transform_factory (
2324+ self .transData , self .transAxes )
23192325 verts = [(xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )]
23202326 p = mpatches .Polygon (verts , ** kwargs )
23212327 p .set_transform (trans )
@@ -2386,7 +2392,7 @@ def hlines(self, y, xmin, xmax, colors='k', linestyle='solid',
23862392 return coll
23872393 hlines .__doc__ = cbook .dedent (hlines .__doc__ )
23882394
2389- def vlines (self , x , ymin , ymax , colors = 'k' , linestyle = 'solid' ,
2395+ def vlines (self , x , ymin , ymax , colors = 'k' , linestyles = 'solid' ,
23902396 label = '' , ** kwargs ):
23912397 """
23922398 VLINES(x, ymin, ymax, color='k')
@@ -2438,7 +2444,7 @@ def vlines(self, x, ymin, ymax, colors='k', linestyle='solid',
24382444 for thisx , (thisymin , thisymax ) in zip (x ,Y )]
24392445 #print 'creating line collection'
24402446 coll = mcoll .LineCollection (verts , colors = colors ,
2441- linestyle = linestyle , label = label )
2447+ linestyles = linestyles , label = label )
24422448 self .add_collection (coll )
24432449 coll .update (kwargs )
24442450
@@ -3660,7 +3666,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
36603666 else :
36613667 lower = y - yerr [0 ]
36623668 upper = y + yerr [1 ]
3663-
3669+
36643670 barcols .append ( self .vlines (x , lower , upper , ** lines_kw ) )
36653671 if capsize > 0 :
36663672
0 commit comments