[R] continuous shading in plots

Rui Barradas ruipbarradas at sapo.pt
Tue Feb 19 00:53:30 CET 2013


Hello,

Or with base R only,

smooth <- colorRampPalette(c('white', 'darkgrey'))
segments(rep(0,100),seq(-4.5,0,length.out=200),rep(14,200),
  seq(0,4.5,length.out=200), col = smooth(200), lwd = 2)


Hope this helps,

Rui Barradas

Em 18-02-2013 23:30, Jim Lemon escreveu:
> On 02/19/2013 09:50 AM, Jim Lemon wrote:
>> 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)
>>
> and even easier:
>
> library(plotrix)
> segments(rep(0,100),seq(-4.5,0,length.out=200),rep(14,200),
>   seq(0,4.5,length.out=200),col=smoothColors("white",198,"darkgray"))
>
> Jim
>
> ______________________________________________
> 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