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.
preguntado el 08 de noviembre de 11 a las 12:11
I think you are looking for the values and the bin sizes.
matplotlib.pyplot.hist() function returns a tupe with (n, bins, patches)
For example to plot some 'data', 150 bins:
import matplotlib.pyplot as plt hist = plt.hist(data,150) binsize = hist value = hist print binsize print '' print value