@@ -618,7 +618,7 @@ def set_anchor(self, anchor):
618618 """
619619 ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
620620 """
621- if anchor in PBox .coefs .keys ():
621+ if anchor in PBox .coefs .keys () or len ( anchor ) == 2 :
622622 self ._anchor = anchor
623623 else :
624624 raise ValueError ('argument must be among %s' %
@@ -667,10 +667,14 @@ def apply_aspect(self, data_ratio = None):
667667 dL = self .dataLim
668668 xr = dL .width ()
669669 yr = dL .height ()
670+ xsize = min (xsize , 1.1 * xr )
671+ ysize = min (ysize , 1.1 * yr )
670672 xmarg = xsize - xr
671673 ymarg = ysize - yr
672674 Ysize = data_ratio * xsize
673675 Xsize = ysize / data_ratio
676+ Xmarg = Xsize - xr
677+ Ymarg = Ysize - xr
674678 # If it is very nearly correct, don't do any more;
675679 # we are probably just panning.
676680 if abs (xsize - Xsize ) < 0.001 * xsize or abs (ysize - Ysize ) < 0.001 * ysize :
@@ -686,8 +690,7 @@ def apply_aspect(self, data_ratio = None):
686690 if changex :
687691 adjust_y = False
688692 else :
689- adjust_y = changey or (Xsize < min (xsize , xr ))
690- adjust_y = adjust_y or (A * ymarg > xmarg )
693+ adjust_y = changey or (Ymarg > xmarg )
691694 if adjust_y :
692695 dy = Ysize - ysize
693696 if ymarg < 0.01 * dy :
@@ -945,7 +948,6 @@ def autoscale_view(self, tight=False):
945948 self .set_xlim (locator .autoscale ())
946949 locator = self .yaxis .get_major_locator ()
947950 self .set_ylim (locator .autoscale ())
948-
949951 #### Drawing
950952
951953 def draw (self , renderer = None , inframe = False ):
@@ -997,6 +999,7 @@ def draw(self, renderer=None, inframe=False):
997999 artists .extend (self .patches )
9981000 artists .extend (self .lines )
9991001 artists .extend (self .texts )
1002+ artists .extend (self .artists )
10001003
10011004 # keep track of i to guarantee stable sort for python 2.2
10021005 dsu = [ (a .zorder , i , a ) for i , a in enumerate (artists )
@@ -1008,9 +1011,6 @@ def draw(self, renderer=None, inframe=False):
10081011
10091012 self .title .draw (renderer )
10101013 if 0 : bbox_artist (self .title , renderer )
1011- # optional artists
1012- for a in self .artists :
1013- a .draw (renderer )
10141014
10151015 if not self ._axisbelow :
10161016 if self .axison and not inframe :
@@ -1027,7 +1027,6 @@ def draw(self, renderer=None, inframe=False):
10271027 self .transData .thaw () # release the lazy objects
10281028 self .transAxes .thaw () # release the lazy objects
10291029 renderer .close_group ('axes' )
1030-
10311030 self ._cachedRenderer = renderer
10321031
10331032 def draw_artist (self , a ):
@@ -3068,8 +3067,10 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
30683067 collection .set_cmap (cmap )
30693068 collection .set_norm (norm )
30703069
3071- if norm is None :
3070+ if vmin is not None or vmax is not None :
30723071 collection .set_clim (vmin , vmax )
3072+ else :
3073+ collection .autoscale ()
30733074
30743075 minx = amin (x )
30753076 maxx = amax (x )
@@ -3411,11 +3412,15 @@ def imshow(self, X,
34113412 im = AxesImage (self , cmap , norm , interpolation , origin , extent ,
34123413 filternorm = filternorm ,
34133414 filterrad = filterrad )
3414- if norm is None and shape is None :
3415- im .set_clim (vmin , vmax )
34163415
34173416 im .set_data (X )
34183417 im .set_alpha (alpha )
3418+ #if norm is None and shape is None:
3419+ # im.set_clim(vmin, vmax)
3420+ if vmin is not None or vmax is not None :
3421+ im .set_clim (vmin , vmax )
3422+ else :
3423+ im .autoscale ()
34193424
34203425 xmin , xmax , ymin , ymax = im .get_extent ()
34213426
@@ -3570,8 +3575,10 @@ def pcolor(self, *args, **kwargs):
35703575 if cmap is not None : assert (isinstance (cmap , Colormap ))
35713576 collection .set_cmap (cmap )
35723577 collection .set_norm (norm )
3573- collection .set_clim (vmin , vmax )
3574-
3578+ if vmin is not None or vmax is not None :
3579+ collection .set_clim (vmin , vmax )
3580+ else :
3581+ collection .autoscale ()
35753582 self .grid (False )
35763583
35773584 x = X .compressed ()
@@ -3677,7 +3684,10 @@ def pcolormesh(self, *args, **kwargs):
36773684 if cmap is not None : assert (isinstance (cmap , Colormap ))
36783685 collection .set_cmap (cmap )
36793686 collection .set_norm (norm )
3680- collection .set_clim (vmin , vmax )
3687+ if vmin is not None or vmax is not None :
3688+ collection .set_clim (vmin , vmax )
3689+ else :
3690+ collection .autoscale ()
36813691
36823692 self .grid (False )
36833693
@@ -4082,7 +4092,7 @@ def spy(self, Z, marker='s', markersize=10, **kwargs):
40824092 x = c .row
40834093 y = c .col
40844094 z = c .data
4085- else :
4095+ else :
40864096 x ,y ,z = matplotlib .mlab .get_xyz_where (Z , Z > 0 )
40874097 return self .plot (x + 0.5 ,y + 0.5 , linestyle = 'None' ,
40884098 marker = marker ,markersize = markersize , ** kwargs )
0 commit comments