[R] Adding shading to background of Time series plot

jmbucci at stat.ucla.edu jmbucci at stat.ucla.edu
Fri Oct 27 01:28:52 CEST 2006


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")



More information about the R-help mailing list