I am trying to fit a power law to a histogram (more exact Pareto distribution). I did it with my own function, where I check for smallest sum of squares of difference. But this means I need to loop threw all the coefitients, which can take some time. Another problem is that I need to make my own data list so that I have histogram data.
So I am looking for a function that would return a list of data made by matplotlib.pyplot.hist() and not just a picture and than I would like to fit this data with pareto distribution abit faster than looping so many times and obtain the coefitions.
I think you are looking for the values and the bin sizes.
The
matplotlib.pyplot.hist()
function returns a tupe with (n, bins, patches)For more information about this function click this link
For example to plot some 'data', 150 bins: