I would like to display the X value in my histogram at which the maximum Y values are present. I followed the example on the page: Find the x value corresponding to a histogram max
and wrote this:
def Plot_show_us(dfus, dfdus, dfnus):
x = dfus['O18ad']
bins=[-22,(...),22] # normaly here are a lot of Bins
n, b, patches =plt.hist(x, bins, alpha=0.65, label='old')
bin_max = np.where(n == n.max())
print('maxbin'), b[bin_max][0]
plt.legend(loc='upper right')
However, I couldn't get any output! What am I doing wrong (I think this is a beginner's mistake)?
my output:
Plot_show_us(dfus, dfdus, dfnus)
maxbin