@@ -2104,16 +2104,21 @@ def make_iterable(x):
2104
2104
if yerr is not None :
2105
2105
yerr = self .convert_yunits (yerr )
2106
2106
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' :
2110
2115
if orientation == 'vertical' :
2111
2116
left = [left [i ] - width [i ] / 2. for i in xrange (len (left ))]
2112
2117
elif orientation == 'horizontal' :
2113
2118
bottom = [bottom [i ] - height [i ] / 2.
2114
2119
for i in xrange (len (bottom ))]
2115
2120
2116
- else :
2121
+ elif align != 'edge' :
2117
2122
raise ValueError ('invalid alignment: %s' % align )
2118
2123
2119
2124
args = zip (left , bottom , width , height , color , edgecolor , linewidth )
@@ -2129,7 +2134,8 @@ def make_iterable(x):
2129
2134
facecolor = c ,
2130
2135
edgecolor = e ,
2131
2136
linewidth = lw ,
2132
- label = '_nolegend_'
2137
+ label = '_nolegend_' ,
2138
+ margins = margins
2133
2139
)
2134
2140
r .update (kwargs )
2135
2141
r .get_path ()._interpolation_steps = 100
@@ -5267,7 +5273,7 @@ def pcolor(self, *args, **kwargs):
5267
5273
5268
5274
kwargs .setdefault ('snap' , False )
5269
5275
5270
- collection = mcoll .PolyCollection (verts , ** kwargs )
5276
+ collection = mcoll .PolyCollection (verts , margins = False , ** kwargs )
5271
5277
5272
5278
collection .set_alpha (alpha )
5273
5279
collection .set_array (C )
@@ -5302,9 +5308,9 @@ def pcolor(self, *args, **kwargs):
5302
5308
maxy = np .amax (y )
5303
5309
5304
5310
corners = (minx , miny ), (maxx , maxy )
5311
+ self .add_collection (collection , autolim = False )
5305
5312
self .update_datalim (corners )
5306
5313
self .autoscale_view ()
5307
- self .add_collection (collection , autolim = False )
5308
5314
return collection
5309
5315
5310
5316
@unpack_labeled_data (label_namer = None )
@@ -5419,7 +5425,8 @@ def pcolormesh(self, *args, **kwargs):
5419
5425
5420
5426
collection = mcoll .QuadMesh (
5421
5427
Nx - 1 , Ny - 1 , coords ,
5422
- antialiased = antialiased , shading = shading , ** kwargs )
5428
+ antialiased = antialiased , shading = shading , margins = False ,
5429
+ ** kwargs )
5423
5430
collection .set_alpha (alpha )
5424
5431
collection .set_array (C )
5425
5432
if norm is not None and not isinstance (norm , mcolors .Normalize ):
@@ -5451,9 +5458,9 @@ def pcolormesh(self, *args, **kwargs):
5451
5458
maxy = np .amax (Y )
5452
5459
5453
5460
corners = (minx , miny ), (maxx , maxy )
5461
+ self .add_collection (collection , autolim = False )
5454
5462
self .update_datalim (corners )
5455
5463
self .autoscale_view ()
5456
- self .add_collection (collection , autolim = False )
5457
5464
return collection
5458
5465
5459
5466
@unpack_labeled_data (label_namer = None )
@@ -5603,7 +5610,8 @@ def pcolorfast(self, *args, **kwargs):
5603
5610
# The QuadMesh class can also be changed to
5604
5611
# handle relevant superclass kwargs; the initializer
5605
5612
# should do much more than it does now.
5606
- collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" )
5613
+ collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" ,
5614
+ margins = False )
5607
5615
collection .set_alpha (alpha )
5608
5616
collection .set_array (C )
5609
5617
collection .set_cmap (cmap )
@@ -5649,15 +5657,19 @@ def contour(self, *args, **kwargs):
5649
5657
if not self ._hold :
5650
5658
self .cla ()
5651
5659
kwargs ['filled' ] = False
5652
- return mcontour .QuadContourSet (self , * args , ** kwargs )
5660
+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5661
+ self .autoscale_view ()
5662
+ return contours
5653
5663
contour .__doc__ = mcontour .QuadContourSet .contour_doc
5654
5664
5655
5665
@unpack_labeled_data ()
5656
5666
def contourf (self , * args , ** kwargs ):
5657
5667
if not self ._hold :
5658
5668
self .cla ()
5659
5669
kwargs ['filled' ] = True
5660
- return mcontour .QuadContourSet (self , * args , ** kwargs )
5670
+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5671
+ self .autoscale_view ()
5672
+ return contours
5661
5673
contourf .__doc__ = mcontour .QuadContourSet .contour_doc
5662
5674
5663
5675
def clabel (self , CS , * args , ** kwargs ):
@@ -6037,6 +6049,11 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
6037
6049
else :
6038
6050
n = [m [slc ].cumsum ()[slc ] for m in n ]
6039
6051
6052
+ if orientation == 'horizontal' :
6053
+ margins = {'left' : False }
6054
+ else :
6055
+ margins = {'bottom' : False }
6056
+
6040
6057
patches = []
6041
6058
6042
6059
if histtype .startswith ('bar' ):
@@ -6177,14 +6194,16 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
6177
6194
patches .append (self .fill (
6178
6195
x , y ,
6179
6196
closed = True ,
6180
- facecolor = c ))
6197
+ facecolor = c ,
6198
+ margins = margins ))
6181
6199
else :
6182
6200
for x , y , c in reversed (list (zip (xvals , yvals , color ))):
6183
6201
split = 2 * len (bins )
6184
6202
patches .append (self .fill (
6185
6203
x [:split ], y [:split ],
6186
6204
closed = False , edgecolor = c ,
6187
- fill = False ))
6205
+ fill = False ,
6206
+ margins = margins ))
6188
6207
6189
6208
# we return patches, so put it back in the expected order
6190
6209
patches .reverse ()
0 commit comments