[R] Adding shading to background of Time series plot

Gabor Grothendieck ggrothendieck at gmail.com
Fri Oct 27 03:36:07 CEST 2006


There is an example here using plot

   http://www.mayin.org/ajayshah/KB/R/html/g5.html

and an example here using xyplot.zoo:


   library(zoo)
   ?xyplot.zoo

that would also work with xyplot.ts



On 10/26/06, jmbucci at stat.ucla.edu <jmbucci at stat.ucla.edu> wrote:
> Hello All,
>
> Thank you in advance.
>
> I have looked up and down in the archives to see if I could find some help
> on moving the polygons to the background of a ts.plot. I've tried
> panel.first in the gpars(...) arguments and trellis.focus, but I get
> errors. Am I missing something easy here? Here is my script:
>
> ts.plot(tsdjia, tstenyield,  gpars = list(xlab = " ", ylab = " ",
> axes=FALSE, col=c(12,14)))
> mtext("Time", side=1, line=3, cex = 0.75, font = 1)
> mtext("Yield", side=4, line=1, cex = 0.75, font = 1)
> mtext("Dow Jones Level", side=2, line=2, cex = 0.7, font = 1)
>
> polygon(cord.x2,cord.y1,col = "gray85")
> polygon(cord.x3,cord.y1,col = "gray85")
> polygon(cord.x4,cord.y1,col = "gray85")
> polygon(cord.x5,cord.y1,col = "gray85")
> polygon(cord.x6,cord.y1,col = "gray85")
>
> ______________________________________________
> 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