Normalizing y-axis in histograms in R ggplot to proportion

Note that ..ncount.. rescales to a maximum of 1.0, while ..count.. is the non scaled bin count.

ggplot(mydataframe, aes(x=value)) +
  geom_histogram(aes(y=..count../sum(..count..)))

Which gives:

enter image description here

Leave a Comment