@@ -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
@@ -5265,7 +5271,7 @@ def pcolor(self, *args, **kwargs):
5265
5271
5266
5272
kwargs .setdefault ('snap' , False )
5267
5273
5268
- collection = mcoll .PolyCollection (verts , ** kwargs )
5274
+ collection = mcoll .PolyCollection (verts , margins = False , ** kwargs )
5269
5275
5270
5276
collection .set_alpha (alpha )
5271
5277
collection .set_array (C )
@@ -5300,9 +5306,9 @@ def pcolor(self, *args, **kwargs):
5300
5306
maxy = np .amax (y )
5301
5307
5302
5308
corners = (minx , miny ), (maxx , maxy )
5309
+ self .add_collection (collection , autolim = False )
5303
5310
self .update_datalim (corners )
5304
5311
self .autoscale_view ()
5305
- self .add_collection (collection , autolim = False )
5306
5312
return collection
5307
5313
5308
5314
@unpack_labeled_data (label_namer = None )
@@ -5417,7 +5423,8 @@ def pcolormesh(self, *args, **kwargs):
5417
5423
5418
5424
collection = mcoll .QuadMesh (
5419
5425
Nx - 1 , Ny - 1 , coords ,
5420
- antialiased = antialiased , shading = shading , ** kwargs )
5426
+ antialiased = antialiased , shading = shading , margins = False ,
5427
+ ** kwargs )
5421
5428
collection .set_alpha (alpha )
5422
5429
collection .set_array (C )
5423
5430
if norm is not None and not isinstance (norm , mcolors .Normalize ):
@@ -5449,9 +5456,9 @@ def pcolormesh(self, *args, **kwargs):
5449
5456
maxy = np .amax (Y )
5450
5457
5451
5458
corners = (minx , miny ), (maxx , maxy )
5459
+ self .add_collection (collection , autolim = False )
5452
5460
self .update_datalim (corners )
5453
5461
self .autoscale_view ()
5454
- self .add_collection (collection , autolim = False )
5455
5462
return collection
5456
5463
5457
5464
@unpack_labeled_data (label_namer = None )
@@ -5601,7 +5608,8 @@ def pcolorfast(self, *args, **kwargs):
5601
5608
# The QuadMesh class can also be changed to
5602
5609
# handle relevant superclass kwargs; the initializer
5603
5610
# should do much more than it does now.
5604
- collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" )
5611
+ collection = mcoll .QuadMesh (nc , nr , coords , 0 , edgecolors = "None" ,
5612
+ margins = False )
5605
5613
collection .set_alpha (alpha )
5606
5614
collection .set_array (C )
5607
5615
collection .set_cmap (cmap )
@@ -5647,15 +5655,19 @@ def contour(self, *args, **kwargs):
5647
5655
if not self ._hold :
5648
5656
self .cla ()
5649
5657
kwargs ['filled' ] = False
5650
- return mcontour .QuadContourSet (self , * args , ** kwargs )
5658
+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5659
+ self .autoscale_view ()
5660
+ return contours
5651
5661
contour .__doc__ = mcontour .QuadContourSet .contour_doc
5652
5662
5653
5663
@unpack_labeled_data ()
5654
5664
def contourf (self , * args , ** kwargs ):
5655
5665
if not self ._hold :
5656
5666
self .cla ()
5657
5667
kwargs ['filled' ] = True
5658
- return mcontour .QuadContourSet (self , * args , ** kwargs )
5668
+ contours = mcontour .QuadContourSet (self , * args , ** kwargs )
5669
+ self .autoscale_view ()
5670
+ return contours
5659
5671
contourf .__doc__ = mcontour .QuadContourSet .contour_doc
5660
5672
5661
5673
def clabel (self , CS , * args , ** kwargs ):
@@ -6035,6 +6047,11 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
6035
6047
else :
6036
6048
n = [m [slc ].cumsum ()[slc ] for m in n ]
6037
6049
6050
+ if orientation == 'horizontal' :
6051
+ margins = {'left' : False }
6052
+ else :
6053
+ margins = {'bottom' : False }
6054
+
6038
6055
patches = []
6039
6056
6040
6057
if histtype .startswith ('bar' ):
@@ -6175,14 +6192,16 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
6175
6192
patches .append (self .fill (
6176
6193
x , y ,
6177
6194
closed = True ,
6178
- facecolor = c ))
6195
+ facecolor = c ,
6196
+ margins = margins ))
6179
6197
else :
6180
6198
for x , y , c in reversed (list (zip (xvals , yvals , color ))):
6181
6199
split = 2 * len (bins )
6182
6200
patches .append (self .fill (
6183
6201
x [:split ], y [:split ],
6184
6202
closed = False , edgecolor = c ,
6185
- fill = False ))
6203
+ fill = False ,
6204
+ margins = margins ))
6186
6205
6187
6206
# we return patches, so put it back in the expected order
6188
6207
patches .reverse ()
0 commit comments