[R] shading in line plots

Mulholland, Tom Tom.Mulholland at dpi.wa.gov.au
Fri Apr 29 05:36:21 CEST 2005


I have snippets of code that I have either taken from examples or off of the list. I apologise to those I have stolen it from but I didn't keep the proper references.


n <- 100
xx <- c(0:n, n:0)
yy <- c(c(0,cumsum(rnorm(n))), rev(c(0,cumsum(rnorm(n)))))
plot   (xx, yy, type="n", xlab="Time", ylab="Distance")
polygon(xx, yy, col="gray", border = "red")
title("Distance Between Brownian Motions")

The list also has

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/12463.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/16809.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/0047.html


Tom
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Heather 
> Joan Lynch
> Sent: Thursday, 28 April 2005 10:14 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] shading in line plots
> 
> 
> Hello,
> 
> I cannot figure out how to shade between two lines in a plot.  For
> example, if I am trying to plot a confidence envelope and I 
> would like to
> shade the interior of the envelope grey.  Is this possible in R?
> 
> Thanks in advance.
> 
> Heather Lynch
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list