[R] invalid colour name 'rgb(1.000,0,0)' error

Rui Barradas ruipbarradas at sapo.pt
Fri Nov 23 14:41:04 CET 2012


Hello,

Why paste? rgb() is a function, you need its return value, not a 
character string.

r <- rgb(1.000,0,0)

And the rest plots a graph in red.

Hope this helps,

Rui Barradas
Em 23-11-2012 09:06, Manish Gupta escreveu:
> Hi,
>
> I m working on latex and R and i need to dynamically generate colors.
>
> r<-paste("rgb(1.000,",0,",",0,")",sep="")   # i m generating dynamically by
> paste command
> cars <- c(1, 3, 6, 4, 9)
> plot(cars, type="o", col=r)                     *Error in plot.xy(xy, type,
> ...) : invalid colour name 'rgb(1.000,0,0)'*
>
> How to fix this pblm? Pls help me out as i m in great need.
>
> Thanks
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/invalid-colour-name-rgb-1-000-0-0-error-tp4650527.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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