@@ -2104,16 +2104,21 @@ def make_iterable(x):
21042104 if yerr is not None :
21052105 yerr = self .convert_yunits (yerr )
21062106
2107- if align == 'edge' :
2108- pass
2109- elif align == 'center' :
2107+ margins = {}
2108+
2109+ if orientation == 'vertical' :
2110+ margins = {'bottom' : False }
2111+ elif orientation == 'horizontal' :
2112+ margins = {'left' : False }
2113+
2114+ if align == 'center' :
21102115 if orientation == 'vertical' :
21112116 left = [left [i ] - width [i ] / 2. for i in xrange (len (left ))]
21122117 elif orientation == 'horizontal' :
21132118 bottom = [bottom [i ] - height [i ] / 2.
21142119 for i in xrange (len (bottom ))]
21152120
2116- else :
2121+ elif align != 'edge' :
21172122 raise ValueError ('invalid alignment: %s' % align )
21182123
21192124 args = zip (left , bottom , width , height , color , edgecolor , linewidth )
@@ -2129,7 +2134,8 @@ def make_iterable(x):
21292134 facecolor = c ,
21302135 edgecolor = e ,
21312136 linewidth = lw ,
2132- label = '_nolegend_'
2137+ label = '_nolegend_' ,
2138+ margins = margins
21332139 )
21342140 r .update (kwargs )
21352141 r .get_path ()._interpolation_steps = 100
@@ -5256,7 +5262,7 @@ def pcolor(self, *args, **kwargs):
52565262
52575263 kwargs .setdefault ('snap' , False )
52585264
5259- collection = mcoll .PolyCollection (verts , ** kwargs )
5265+ collection = mcoll .PolyCollection (verts , margins = False , ** kwargs )
52605266
52615267 collection .set_alpha (alpha )
52625268 collection .set_array (C )
@@ -5291,9 +5297,9 @@ def pcolor(self, *args, **kwargs):
52915297 maxy = np .amax (y )
52925298
52935299 corners = (minx , miny ), (maxx , maxy )
5300+ self .add_collection (collection , autolim = False )
52945301 self .update_datalim (corners )
52955302 self .autoscale_view ()
5296- self .add_collection (collection , autolim = False )
52975303 return collection
52985304
52995305 @unpack_labeled_data (label_namer = None )
@@ -5408,7 +5414,8 @@ def pcolormesh(self, *args, **kwargs):
54085414
54095415 collection = mcoll .QuadMesh (
54105416 Nx - 1 , Ny - 1 , coords ,
5411- antialiased = antialiased , shading = shading , ** kwargs )
5417+ antialiased = antialiased , shading = shading , margins = False ,
5418+ ** kwargs )
54125419 collection .set_alpha (alpha )
54135420 collection .set_array (C )
54145421 if norm is not None and not isinstance (norm , mcolors .Normalize ):
@@ -5440,9 +5447,9 @@ def pcolormesh(self, *args, **kwargs):
54405447 maxy = np .amax (Y )
54415448
54425449 corners = (minx , miny ), (maxx , maxy )
5450+ self .add_collection (collection , autolim = False )
54435451 self .update_datalim (corners )
54445452 self .autoscale_view ()
5445- self .add_collection (collection , autolim = False )
54465453 return collection
54475454
54485455 @unpack_labeled_data (label_namer = None )
@@ -5592,7 +5599,8 @@ def pcolorfast(self, *args, **kwargs):
55925599 # The QuadMesh class can also be changed to
55935600 # handle relevant superclass kwargs; the initializer
55945601 # should do much more than it does now.
5595- collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" )
5602+ collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" ,
5603+ margins = False )
55965604 collection .set_alpha (alpha )
55975605 collection .set_array (C )
55985606 collection .set_cmap (cmap )
@@ -5638,15 +5646,19 @@ def contour(self, *args, **kwargs):
56385646 if not self ._hold :
56395647 self .cla ()
56405648 kwargs ['filled' ] = False
5641- return mcontour .QuadContourSet (self , * args , ** kwargs )
5649+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5650+ self .autoscale_view ()
5651+ return contours
56425652 contour .__doc__ = mcontour .QuadContourSet .contour_doc
56435653
56445654 @unpack_labeled_data ()
56455655 def contourf (self , * args , ** kwargs ):
56465656 if not self ._hold :
56475657 self .cla ()
56485658 kwargs ['filled' ] = True
5649- return mcontour .QuadContourSet (self , * args , ** kwargs )
5659+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5660+ self .autoscale_view ()
5661+ return contours
56505662 contourf .__doc__ = mcontour .QuadContourSet .contour_doc
56515663
56525664 def clabel (self , CS , * args , ** kwargs ):
@@ -6026,6 +6038,11 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
60266038 else :
60276039 n = [m [slc ].cumsum ()[slc ] for m in n ]
60286040
6041+ if orientation == 'horizontal' :
6042+ margins = {'left' : False }
6043+ else :
6044+ margins = {'bottom' : False }
6045+
60296046 patches = []
60306047
60316048 if histtype .startswith ('bar' ):
@@ -6166,14 +6183,16 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
61666183 patches .append (self .fill (
61676184 x , y ,
61686185 closed = True ,
6169- facecolor = c ))
6186+ facecolor = c ,
6187+ margins = margins ))
61706188 else :
61716189 for x , y , c in reversed (list (zip (xvals , yvals , color ))):
61726190 split = 2 * len (bins )
61736191 patches .append (self .fill (
61746192 x [:split ], y [:split ],
61756193 closed = False , edgecolor = c ,
6176- fill = False ))
6194+ fill = False ,
6195+ margins = margins ))
61776196
61786197 # we return patches, so put it back in the expected order
61796198 patches .reverse ()
0 commit comments