conflict between stacked and normed in hist?

I am trying to use stacked and normed at the same time. I have thought
about it - and I think it does make sense for what I want to do.

Below is some code and a figure that demonstrate the problem. There are two
histograms. Both use teh same data. Both are stacked. The top histogram
uses normed=False. The bottom uses normed =True. Ideally, the histograms
would be identical except for scaling on the y-axis.

The histogram with normed=False looks OK.

The left-half of the normed=True histogram looks OK. About half-way through
the second distribution moves from the top of the bars to the bottom. At
least that's the way it looks from eyeballing.

Does anybody have a suggestion about how to get around this problem? Should
I be reporting a bug somewhere?

Wayne Hajas



from numpy.random import normal,seed
import matplotlib.pyplot as plt

bins=map(lambda i:-2.+5.*float(i)/float(50),range(51))

plt.hist([x,y],bins=bins,alpha=0.5, stacked=True,normed=False)

plt.hist([x,y],bins=bins,alpha=0.5, stacked=True,normed=True)


View this message in context:
Sent from the matplotlib - users mailing list archive at