Search code examples
matplotlibhistogram

Cumulative histogram has last point at y=0


I am creating histogram with

pylab.hist(data,weights,histtype='step',normed=False,bins=150,cumulative=True)

getting (there are other plots, which are irrelevant now) the violet line

histogram

Why is the histogram dropping to zero at the end again? Cumulative functions should be in general non-decreasing. Is there a way to work around this, be it bug or feature?


Solution

  • This is default behaviour. Think of it as an outline of the histogram as a bar chart. As for a quick workaround, not that I am aware of. A solution would be to calculate the histogram on your own: python histogram one-liner