Re: [R] Add function to histogram?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed 21 Sep 2005 - 16:21:03 EST

On 9/20/05, Robert Lundqvist <Robert.Lundqvist@ltu.se> wrote:
> Is there any neat way to add a curve (frequency function or the like) to a
> histogram or other plots? I haven't found one yet...

Try this:

set.seed(1)
z <- rnorm(100)
library(MASS)
truehist(z)
lines(density(z))
curve(dnorm, color = "red", add = TRUE)



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 Wed Sep 21 16:26:50 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:33:25 EST