[R] image() colors

Deepayan Sarkar deepayansarkar at yahoo.com
Tue Aug 7 19:11:43 CEST 2001



You might want to use the `breaks=' argument. You
would have to decide on the breakpoints and the
associated colors beforehand, but that seems OK if you
know Cl:

breaks <- 0:Cl + 0.5 # assuming classes 1,2,...,Cl
col <- terrain.colors(Cl)

image(X,...,col=col, breaks=breaks)
image(Y,...,col=col, breaks=breaks)




--- Elena MOLTCHANOVA <moltchan at iiasa.ac.at> wrote:
> Hi, everybody!
> 
> I am currently dealing with spatial estimation and
> thus writing some 
> smoothing algorithms. My question concerns the
> graphical output. I would 
> like my function to produce a picture of input data
> (X) and of estimation 
> results(Y). Both, X and Y are categorical variables
> which can take values 
> 1,2,...,Cl. So, basically I write
> 
> foo<-function(){
> ....
> 
> image(X,...,col=terrain.colors(Cl))
> image(Y,...,col=terrain.colors(Cl))
> }
> 
> However, as a result of smoothing, some classes may
> disappear completely. 
> For example:
> 
> 	  X		  Y
> 	1 1 1		1 1 1
> 	1 0 1		1 1 1
> 	1 1 1		1 1 1
> 
> In output then graph for X would have green for 0
> and yellow for 1, whereas 
> the graph for Y would be all green. Thus the two
> pictures cannot be 
> compared. Is there any way around this problem?


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list