Re: [R] defining color sequence in image()

From: talepanda <talepanda_at_gmail.com>
Date: Tue 26 Dec 2006 - 08:42:18 GMT

one solution is:

img1<-matrix(1:5)
img2<-matrix(2:5)

col<-1:5 # col<-c("green","yellow",...)
image(img1,col=col[sort(unique(img1))])
image(img2,col=col[sort(unique(img2))])

On 12/26/06, Milton Cezar Ribeiro <milton_ruser@yahoo.com.br> wrote:
> Dear All,
>
> How can I define a color sequence for each image value? I have several
> images with values varying from 1 to 5, and I would like to assing a fixed
> color for each value (green for 1, yellow for 2...). I used somethink like:
>
> > image(img,col=c("green","yellow",...))
>
> but unfortunately whem I have absent values, the color that I defined for
> each values change.
>
> Thanks a lot,
>
> Miltinho
> Brazil
>
> PS : Merry Christmas!!!
>
> __________________________________________________
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>



R-help@stat.math.ethz.ch 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. Received on Tue Dec 26 19:51:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 26 Dec 2006 - 09:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.