plt.hist function in python is not showing the correct exponential distribution

353 Views Asked by At

I am trying to plot the probability distribution function of a simulation that involved the 2-dimensional kinetic distribution. My result should be an exponentially decaying function and I require it to be normalized. To obtain this, I took my list (X) and I used

`plt.hist(X, bins= 100, density= 'True')`

The graph I'm obtaining:

The graph

According to the equation EXP(-x/c), for x = 0, the y-axis should be at 1. Can someone help me, please?

1

There are 1 best solutions below

4
On

I believe the density argument normalizes the histogram to add up to one, not to have a maximum of one.

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html

I don't think the result is wrong, is there some reason you need the normalization to be to the max instead of to the total number of counts, which probably has less variance?