On 4 February 2011 at 07:55, David Bickel wrote: | Is there a function that can shade the region between two arbitrary | curves? For example, how can I fill in the area between these two | plotted curves? | | > x <- 1:10 | > y <- x + rnorm(10) | > z <- x + 10 + rnorm(10) | > plot(x, y, type = "l", ylim = c(0,20)) | > lines(x, z)
Yes, this can be done using polygon(). For a worked example please see http://dirk.eddelbuettel.com/blog/2011/01/16#overbought_oversold_plot which contains a complete example (for shading plus/minus one and day rolling standard deviations around a rolling mean for financial times series): | I would appreciate any help. Hope this helps. No need to post three times, by the way. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com ______________________________________________ R-help@r-project.org 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.