[R] how to draw multiple vertical bands

Petr PIKAL petr.pikal at precheza.cz
Tue Apr 20 15:05:26 CEST 2010


Hi

you can also use abline function

x<-rnorm(10)
plot(1:10, x)
abline(v=seq(2,10,2), lwd=50, col="lightblue")
lines(1:10, x, type="b")

Regards
Petr

r-help-bounces at r-project.org napsal dne 19.04.2010 20:59:15:

> 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?
> > 
> 
> See the source code for nber.xy and nberShade.ggplot in the "tis" 
> package by Jeff Hallman. They both do what you want.
> 
> I'm working on something similar. Besides drawing the bands, my version 
> will also vary heights optionally (rather than have bands stretching the 

> entire height of the graph) and use ggplot2.
> 
>      Marsh Feldman
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list