[R] Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : must have one more break than colour

David Winsemius dwinsemius at comcast.net
Mon Nov 17 18:41:56 CET 2008


On Nov 17, 2008, at 12:30 PM, David Winsemius wrote:

>
> On Nov 17, 2008, at 11:01 AM, paul murima wrote:
>
>> heatmap.2(m, margins= c(9,9), col = bluered(64), trace=c("none"),
>> breaks=c(seq(-60,0,60/20)), symkey=TRUE, density.info="histogram",
>> cexRow=1,)
>> Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim =  
>> 0.5 +  :
>> must have one more break than colour
>
> Thisnewbies reading of the error message and the function call:
>    -request for what appears to be 64 colors
> (Although my current set up does not recognize the function  
> bluered(), I will assume that you have a package that provides  
> bluered.)
>    -3 breaks .... since 60/20 = 3

My efforts at being a substitute R interpreter were erroneous  (but  
the inference still holds since 21 is less than 64)
 > c(seq(-60,0,60/20))
  [1] -60 -57 -54 -51 -48 -45 -42 -39 -36 -33 -30 -27 -24 -21 -18 -15  
-12  -9  -6  -3   0
 > length(c(seq(-60,0,60/20)))
[1] 21

>
>    -an error message that says that is unacceptable.
>
> Suggest you look at ?seq more carefully.
>
>
> -- 
> David Winsemius
>
>
>>
>>
>> Hie all.
>>
>> I am working on scaling my data into a fited range of -60 0 and 60,
>> with increases of 20.
>> when i use heatmap,2 the error messgae i get is as follows
>>
>> heatmap.2(m, margins= c(9,9), col = bluered(64), trace=c("none"),
>> breaks=c(seq(-60,0,60/20)), symkey=TRUE, density.info="histogram",
>> cexRow=1,)
>>
>> Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim =  
>> 0.5 +  :
>> must have one more break than colour
>>
>> Can any one help on how i can get around this problem.
>> Your help is most appreciated.
>>
>> Rockie
>>
>> ______________________________________________
>> 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.
>
> ______________________________________________
> 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