Histogram of image pixel intensities and the density of a particular intensity

What I am trying to do:

What I able to do as of now:

I know the layout thing,pls help with the fraction part
how to make that line that tells fraction of representation of a particular intensity in whole spectrum…

If this isn’t a homework question, see

If it is, you shouldn’t look, because it’s the exact answer and you’ll lose out by not figuring it out on your own. Instead, read the documentation for https://github.com/JuliaImages/ImageContrastAdjustment.jl