[R] heatmap color specification

Xiaohui chenxh007 at gmail.com
Mon Feb 12 21:05:44 CET 2007


Jim Lemon wrote:
> Xiaohui wrote:
>> ... Then, I did a heatmap for 'test' matrix. But for now, I want to 
>> specify each of the cell in the heatmap according to the values of 
>> the corresponding matrix elements of test.
>>
>> Let's say: col<-c("red","yellow","green")
>>
>> for test[1,1], the color on the map should be "red".
>>
>> I have tried par('usr') and par('mar') with rect function. But this 
>> does not work because the rect shift from the original map. Could any 
>> one tell me how to fill the cells on the map with corresponding 
>> values? Or can we get the actual coordinates of the image excluding 
>> the dendregram.
> Hi Xiaohui,
> You may be looking for something like color2D.matplot in the plotrix 
> package or "image" in the graphics package.
>
> Jim
>
Thanks, Jim. I found this problem can be solve with the 'scale' 
parameter specified to FALSE. If it is TRUE, then the positive integer 
is scale to a real number which will cause the problem earlier.

Xiaohui



More information about the R-help mailing list