I re-worded this to confirm to the idea of S.O. (thanks Michael0x2a)
I have been trying to find the x value associated with the maximum of a histogram plotted in matplotlib.pyplot
. At first I had trouble even finding out how to access the data of the histogram just using the code
import matplotlib.pyplot as plt
# Dealing with sub figures...
fig = plt.figure()
ax = fig.add_subplot(111)
ax.hist(<your data>, bins=<num of bins>, normed=True, fc='k', alpha=0.3)
plt.show()
Then after doing some reading online (and around these forums) I found that you can 'extract' the histogram data like so:
n, bins, patches = ax.hist(<your data>, bins=<num of bins>, normed=True, fc='k', alpha=0.3)
Basically I need to know how to find the value of bins
that the maximum n
corresponds to!
Cheers!