[R] Histogram frequencies with a normal pdf curve overlay

S Ellison S.Ellison at lgc.co.uk
Sun May 10 00:09:25 CEST 2009

Assuming a constant bin width, you need to multiply the density by
n*binwidth, where the bin width is (obviously!) the width of the
histogram bins.

>>> Jacques Wagnor <jacques.wagnor at gmail.com> 05/09/09 5:10 PM >>>
Dear List,

When I plot a histogram with 'freq=FALSE' and overlay the histogram
with a normal pdf curve, everything looks as expected, as follows:

x <- rnorm(1000)
hist(x, freq=FALSE)
curve(dnorm(x), add=TRUE, col="blue")

What do I need to do if I want to show the frequencies (freq=TRUE)
with the same normal pdf overlay, so that the plot would still look
the same?



platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
major          2
minor          8.0
year           2008
month          10
day            20
svn rev        46754
language       R
version.string R version 2.8.0 (2008-10-20)

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

This email and any attachments are confidential. Any use...{{dropped:8}}

More information about the R-help mailing list