Get data points from a histogram in Python

I made a histogram of the "cdf" (cumulative distribution) function. A histogram is basically the number of readings versus luminosity. Now, how to extract data from a histogram? I need the actual luminosity values. I use Matplotlib in Python, and any online book like tutorial etc. Does not help.

l= [ss.gammainccinv(aa+1, u[i]) for i in a] #is the cdf function
plt.hist(l, 50, histtype= 'step', align='mid') #is the histogram
plt.show()

I'm not sure if I should align the cells at the edges or midpoint, but all I need is a list l.

Any suggestions would be greatly appreciated!

+4
source share
1 answer

l s, , , , , .

, plt.hist , , , .

, :

In [34]: x = np.random.rand(100)

In [35]: plt.hist(x)
Out[35]: 
(array([ 11.,   9.,  10.,   6.,   8.,   8.,  10.,  10.,  11.,  17.]),
 array([ 0.00158591,  0.100731  ,  0.19987608,  0.29902116,  0.39816624,
        0.49731133,  0.59645641,  0.69560149,  0.79474657,  0.89389165,
        0.99303674]),
 <a list of 10 Patch objects>)

, , :

counts, bins, bars = plt.hist(x)
+9

All Articles