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 <[EMAIL PROTECTED]> 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.