1

I have a set of data log10(LR), that I will like to show the distribution of in a histogram.

I am using plt.hist from matplotlib to present the data.

However, it is showing the y axis as a max of 3.5 and I can't figure out why.

bins = np.linspace(-2, 3, 30)
plt.hist (y, bins, label=['M', 'CNM'], density= True, align= 'mid')
plt.title('Calibrated Likelihood Ratio for 6 minutiae')
plt.xlabel('log10(LRk)')
plt.legend(loc = 'upper right')
plt.show()

Output of the code

I have included an image of the code output. I would like to know what I am missing from this plot, thanks in advance.

Matt Hall
  • 7,614
  • 1
  • 23
  • 36
mattp
  • 65
  • 9
  • 1
    What makes you think that there's something wrong with the plot? 3.5 is a perfectly fine value for a *probability density*. – Dion Oct 02 '19 at 10:19
  • This seems to be a misinterpretation of the chart. The bar with height 3.6 tells you that the probability to find a value between `-1.138` and `-0.966` is `(-0.966 + 1.138)*3.6 = 0.62 = 62%`. – ImportanceOfBeingErnest Oct 02 '19 at 15:49
  • @ImportanceOfBeingErnest okay thank you. so I need it to be displaying the 0.62 value on the y-axis, do you know what my code is missing to achieve this? – mattp Oct 03 '19 at 07:30
  • See https://stackoverflow.com/questions/3866520/plotting-histograms-whose-bar-heights-sum-to-1-in-matplotlib – ImportanceOfBeingErnest Oct 03 '19 at 13:04

0 Answers0