@@ -7927,8 +7927,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
79277927 # multiple hist with data of different length
79287928 x = [np .asarray (xi ) for xi in x ]
79297929
7930- x = x [::- 1 ] # reverse datasets for caculating stacked hist
7931-
79327930 nx = len (x ) # number of datasets
79337931
79347932 if color is None :
@@ -7952,8 +7950,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
79527950 else :
79537951 w = [np .asarray (wi ) for wi in weights ]
79547952
7955- w = w [::- 1 ] # reverse weights to match datasets
7956-
79577953 if len (w ) != nx :
79587954 raise ValueError ('weights should have the same shape as x' )
79597955 for i in xrange (nx ):
@@ -7999,7 +7995,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
79997995
80007996 n = []
80017997 mlast = bottom
8002- for i in xrange (nx ):
7998+ # reversed order is necessary so when stacking histogram, first dataset is on top
7999+ # if histogram isn't stacked, this doesn't make any difference
8000+ for i in reversed (xrange (nx )):
80038001 # this will automatically overwrite bins,
80048002 # so that each histogram uses the same bins
80058003 m , bins = np .histogram (x [i ], bins , weights = w [i ], ** hist_kwargs )
@@ -8023,8 +8021,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
80238021 else :
80248022 n = [m [slc ].cumsum ()[slc ] for m in n ]
80258023
8026- if stacked :
8027- n .reverse () # put them back in the right order
8024+ n .reverse () # put them back in the right order
80288025
80298026 patches = []
80308027
0 commit comments