@@ -522,7 +522,7 @@ def set_figure(self, fig):
522
522
self .bbox = mtransforms .TransformedBbox (self ._position ,
523
523
fig .transFigure )
524
524
# these will be updated later as data is added
525
- self .dataLim = mtransforms .Bbox .unit ()
525
+ self .dataLim = mtransforms .Bbox .null ()
526
526
self .viewLim = mtransforms .Bbox .unit ()
527
527
self .transScale = mtransforms .TransformWrapper (
528
528
mtransforms .IdentityTransform ())
@@ -1625,13 +1625,16 @@ def relim(self):
1625
1625
# Collections are deliberately not supported (yet); see
1626
1626
# the TODO note in artists.py.
1627
1627
self .dataLim .ignore (True )
1628
+ self .dataLim .set_points (mtransforms .Bbox .null ().get_points ())
1628
1629
self .ignore_existing_data_limits = True
1630
+
1629
1631
for line in self .lines :
1630
1632
self ._update_line_limits (line )
1631
1633
1632
1634
for p in self .patches :
1633
1635
self ._update_patch_limits (p )
1634
1636
1637
+
1635
1638
def update_datalim (self , xys , updatex = True , updatey = True ):
1636
1639
"""
1637
1640
Update the data lim bbox with seq of xy tups or equiv. 2-D array
@@ -8290,14 +8293,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8290
8293
else :
8291
8294
w = [None ]* nx
8292
8295
8293
- # Save autoscale state for later restoration; turn autoscaling
8294
- # off so we can do it all a single time at the end, instead
8295
- # of having it done by bar or fill and then having to be redone.
8296
- _saved_autoscalex = self .get_autoscalex_on ()
8297
- _saved_autoscaley = self .get_autoscaley_on ()
8298
- self .set_autoscalex_on (False )
8299
- self .set_autoscaley_on (False )
8300
-
8301
8296
# Save the datalimits for the same reason:
8302
8297
_saved_bounds = self .dataLim .bounds
8303
8298
@@ -8355,6 +8350,14 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8355
8350
patches = []
8356
8351
8357
8352
if histtype .startswith ('bar' ):
8353
+ # Save autoscale state for later restoration; turn autoscaling
8354
+ # off so we can do it all a single time at the end, instead
8355
+ # of having it done by bar or fill and then having to be redone.
8356
+ _saved_autoscalex = self .get_autoscalex_on ()
8357
+ _saved_autoscaley = self .get_autoscaley_on ()
8358
+ self .set_autoscalex_on (False )
8359
+ self .set_autoscaley_on (False )
8360
+
8358
8361
totwidth = np .diff (bins )
8359
8362
8360
8363
if rwidth is not None :
@@ -8404,6 +8407,10 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8404
8407
bottom [:] = m
8405
8408
boffset += dw
8406
8409
8410
+ self .set_autoscalex_on (_saved_autoscalex )
8411
+ self .set_autoscaley_on (_saved_autoscaley )
8412
+ self .autoscale_view ()
8413
+
8407
8414
elif histtype .startswith ('step' ):
8408
8415
# these define the perimeter of the polygon
8409
8416
x = np .zeros (4 * len (bins ) - 3 , np .float )
@@ -8467,11 +8474,11 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8467
8474
for x , y , c in reversed (zip (xvals , yvals , color )):
8468
8475
if fill :
8469
8476
patches .append (self .fill (x , y ,
8470
- closed = False ,
8477
+ closed = True ,
8471
8478
facecolor = c ))
8472
8479
else :
8473
8480
patches .append (self .fill (x , y ,
8474
- closed = False , edgecolor = c ,
8481
+ closed = True , edgecolor = c ,
8475
8482
fill = False ))
8476
8483
8477
8484
# we return patches, so put it back in the expected order
@@ -8529,10 +8536,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8529
8536
self .update_datalim (
8530
8537
[(0 , bins [0 ]), (0 , bins [- 1 ])], updatex = False )
8531
8538
8532
- self .set_autoscalex_on (_saved_autoscalex )
8533
- self .set_autoscaley_on (_saved_autoscaley )
8534
- self .autoscale_view ()
8535
-
8536
8539
if nx == 1 :
8537
8540
return n [0 ], bins , cbook .silent_list ('Patch' , patches [0 ])
8538
8541
else :
0 commit comments