Re: [R] Density curve over a histogram

From: Paul Smith <phhs80_at_gmail.com>
Date: Thu 28 Apr 2005 - 04:22:08 EST

On 4/27/05, Achim Zeileis <Achim.Zeileis@wu-wien.ac.at> wrote:
> > I would like to draw a picture with the density curve of a normal
> > distribution over a histogram of a set of random numbers extracted
> > from the same normal distribution. Is that possible?
>
> To quote Simon `Yoda' Blomberg: "This is R. There is no if. Only how."
> (see fortune("Yoda"))
>
> Try:
>
> R> x <- rnorm(100)
> R> hist(x, freq = FALSE)
> R> curve(dnorm, col = 2, add = TRUE)

Fantastic! Thanks a lot, Achim.

Paul



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Apr 28 04:51:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:27 EST