[R] Highlight overlapping area between two curves
Christos Hatzis
christos at nuverabio.com
Tue Mar 13 05:24:50 CET 2007
See
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=7
and code therein.
-Christos
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nguyen
> Dinh Nguyen
> Sent: Tuesday, March 13, 2007 12:20 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Highlight overlapping area between two curves
>
> Dear R helpers,
> I have a graph as following; I would like to highlight the
> overlapping area between the two curves. Do you know how to do this?
> Thank you in advance for your help.
> Nguyen
>
> ###START
> x1 <- rnorm(10000, 0.70,0.12)
> x2 <- rnorm(10000, 0.90,0.12)
>
> d1 <- density(x1)
> d2 <- density(x2)
>
> plot(range(d1$x,d2$x), range(d1$y, d2$y), type = "n",
> xlab = "X value", ylab = "Probability Density" )
>
> lines(d1, col = "red",lwd=4, lty=2)
> lines(d2, col = "blue",lwd=4)
>
> ##END CODE
>
> ______________________________________________
> 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