[R] continuous shading in plots

Jim Lemon jim at bitwrit.com.au
Mon Feb 18 23:50:11 CET 2013


On 02/19/2013 01:20 AM, Elisabeth wever wrote:
>
>
>
>
> Hi, Can someone help me with the following?  I currently have the following plot: plot(c(0,14,0,14),c(0,5,0,5),ann = FALSE, xaxs="i", yaxs="i",bty="L" )
> polygon(c(0,18,18), c(0,6,0), col='light grey', border = NA)
> polygon(c(0,18,18), c(0,2,0), col='grey', border = NA) However, I would like to make such a plot, but where there is a continuous shading changing fom white to darkgrey. Can anyone give me any suggsetions how to do this in R? Thank you, Elisabeth   		 	   		
> 	[[alternative HTML version deleted]]
>
Hi Elisabeth,
For a quick hack, try this:

segments(rep(0,100),seq(-4.5,0,length.out=200),rep(14,200),
  seq(0,4.5,length.out=200),
  col=rgb(seq(0.8,0.5,length.out=200),seq(0.8,0.5,length.out=200),
  seq(0.8,0.5,length.out=200)),lwd=2)

Jim



More information about the R-help mailing list