[R] two density curves in one plot?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Aug 23 16:37:10 CEST 2006


With lattice graphics:

library(lattice)
d1 <- rnorm(100)
d2 <- runif(100)
densityplot(~ d1 + d2, auto.key = TRUE)

On 8/23/06, Antje <niederlein-rstat at yahoo.de> wrote:
> Hello,
>
> I was wondering if I can plot two curves I get from "density(data)" into
> one plot. I want to compare both.
> With the following commad, I just get one curve plotted:
>
> plot( density(mydata) )
>
> Sorry for this stupid question but I could not find a solution until now...
>
> Antje
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list