@@ -8320,18 +8320,18 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
83208320 hist_kwargs = dict (range = bin_range )
83218321
83228322 n = []
8323- mlast = bottom
8323+ mlast = None
83248324 for i in xrange (nx ):
83258325 # this will automatically overwrite bins,
83268326 # so that each histogram uses the same bins
83278327 m , bins = np .histogram (x [i ], bins , weights = w [i ], ** hist_kwargs )
83288328 m = m .astype (float ) # causes problems later if it's an int
8329- if mlast is None :
8330- mlast = np .zeros (len (bins )- 1 , m .dtype )
83318329 if normed and not stacked :
83328330 db = np .diff (bins )
83338331 m = (m .astype (float ) / db ) / m .sum ()
83348332 if stacked :
8333+ if mlast is None :
8334+ mlast = np .zeros (len (bins )- 1 , m .dtype )
83358335 m += mlast
83368336 mlast [:] = m
83378337 n .append (m )
@@ -8422,6 +8422,12 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84228422 x [0 :2 * len (bins )- 1 :2 ], x [1 :2 * len (bins )- 1 :2 ] = bins , bins [:- 1 ]
84238423 x [2 * len (bins )- 1 :] = x [1 :2 * len (bins )- 1 ][::- 1 ]
84248424
8425+ if bottom is None :
8426+ bottom = np .zeros (len (bins )- 1 , np .float )
8427+
8428+ y [1 :2 * len (bins )- 1 :2 ], y [2 :2 * len (bins ):2 ] = bottom , bottom
8429+ y [2 * len (bins )- 1 :] = y [1 :2 * len (bins )- 1 ][::- 1 ]
8430+
84258431 if log :
84268432 if orientation == 'horizontal' :
84278433 self .set_xscale ('log' , nonposx = 'clip' )
@@ -8457,12 +8463,13 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84578463
84588464 xvals , yvals = [], []
84598465 for m in n :
8460- # starting point for drawing polygon
8461- y [0 ] = y [1 ]
8462- # top of the previous polygon becomes the bottom
8463- y [2 * len (bins )- 1 :] = y [1 :2 * len (bins )- 1 ][::- 1 ]
8466+ if stacked :
8467+ # starting point for drawing polygon
8468+ y [0 ] = y [1 ]
8469+ # top of the previous polygon becomes the bottom
8470+ y [2 * len (bins )- 1 :] = y [1 :2 * len (bins )- 1 ][::- 1 ]
84648471 # set the top of this polygon
8465- y [1 :2 * len (bins )- 1 :2 ], y [2 :2 * len (bins )- 1 :2 ] = m , m
8472+ y [1 :2 * len (bins )- 1 :2 ], y [2 :2 * len (bins ):2 ] = m + bottom , m + bottom
84668473 if log :
84678474 y [y < minimum ] = minimum
84688475 if orientation == 'horizontal' :
0 commit comments