@@ -8293,14 +8293,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
82938293 else :
82948294 w = [None ]* nx
82958295
8296- # Save autoscale state for later restoration; turn autoscaling
8297- # off so we can do it all a single time at the end, instead
8298- # of having it done by bar or fill and then having to be redone.
8299- _saved_autoscalex = self .get_autoscalex_on ()
8300- _saved_autoscaley = self .get_autoscaley_on ()
8301- self .set_autoscalex_on (False )
8302- self .set_autoscaley_on (False )
8303-
83048296 # Save the datalimits for the same reason:
83058297 _saved_bounds = self .dataLim .bounds
83068298
@@ -8358,6 +8350,14 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
83588350 patches = []
83598351
83608352 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+
83618361 totwidth = np .diff (bins )
83628362
83638363 if rwidth is not None :
@@ -8407,6 +8407,10 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84078407 bottom [:] = m
84088408 boffset += dw
84098409
8410+ self .set_autoscalex_on (_saved_autoscalex )
8411+ self .set_autoscaley_on (_saved_autoscaley )
8412+ self .autoscale_view ()
8413+
84108414 elif histtype .startswith ('step' ):
84118415 # these define the perimeter of the polygon
84128416 x = np .zeros (4 * len (bins ) - 3 , np .float )
@@ -8532,11 +8536,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
85328536 self .update_datalim (
85338537 [(0 , bins [0 ]), (0 , bins [- 1 ])], updatex = False )
85348538
8535- self .set_autoscalex_on (_saved_autoscalex )
8536- self .set_autoscaley_on (_saved_autoscaley )
8537- self .relim ()
8538- self .autoscale_view ()
8539-
85408539 if nx == 1 :
85418540 return n [0 ], bins , cbook .silent_list ('Patch' , patches [0 ])
85428541 else :
0 commit comments