[R] Color2D.matplot uniform color range
jim at bitwrit.com.au
Tue Dec 13 12:12:51 CET 2011
On 12/13/2011 02:15 AM, jalfaro wrote:
> Hi Jim,
> Thanks so much for your help. I have read several of your responses on this
> mailing list and they have helped me out quite a bit as I have gotten more
> and more used to R.
> I am still a little confused here by your response.
> I think you understood my requirements correctly.
> In your words:
> I want to anchor the extremes of the scales regardless of the values in the
> I want 1 color gradient for values between 0 and 1 with a lowerbound cutoff
> at 0.5.
> I want a second color gradient for values between 1 and infinity with an
> upper bound cutoff at 3.
> The function now reads as follows:
> h0<- read.csv(file=filename,head=TRUE,sep=",",row.names=1)
> d =data.matrix(h0)
> d<- d[ind,ind]
> cellcolors[d>= 1& d< 3]<- color.scale(c(1,3,d[d>= 1& d< 3]),
> cellcolors[d>= 2]<-"red"
> However when I execute this function I get the following error:
> Error in color.scale(c(0, 1, d[d< 1]), cs1 = c(0, 0, 1), cs2 = c(0, 0, :
> only 0's may be mixed with negative subscripts
My fault, the line should read:
I always forget that the unary minus has precedence over the sequence
More information about the R-help