On 04/15/2010 12:36 AM, senne wrote:
hi R gurus

I saw some graphs with vertical band like this one:

http://pragcap.com/wp-content/uploads/2010/04/GS.png

how to draw the blue band in R, can't find any clue to do this,any ideas?

Hi senne,
The rect function in base graphics can do the job. First do the plot with type="n" (i.e. no plotting), then display your rectangles:

xylim<-par("usr")
rect.left<-as.Date(seq(paste(rep(c("Dec","Mar","Jun","Sep"),length.out=10),
 c("07","08","08","08","08","09","09","09","09","10"),sep="-")))
rect.right<-rect.left+10
rect(rect.left,xylim[3],rect.right,xylim[4],col="lightblue",border="lightblue")

then draw the line and text labels.

Warning - untested

Jim

______________________________________________
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.

Reply via email to