[R] heatmap.2 ordering & color key

Jason Skelton jps at sanger.ac.uk
Wed Oct 20 15:00:30 CEST 2004


HI All

sorry if this question has already been asked but I couldn't find 
anything that answered my question

I have 24 columns of data that I'm trying to plot in heatmap.2 
(gregmisc) and I'm having difficulty ordering them except in numerical 
sequence:
I have transposed my matrix so it will appear with the dendrogram I want 
appearing at the top of the heatmap
If I use either of these orders the ordering works:
order <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)
order2 <- c(24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)
using the command:
heatmap.2(tmatrix, clusteredmatrixasdendrogram, col=bluered600, 
dendrogram="column", scale="none", trace="none", Rowv=order)
however If I start mixing the numbers up e.g:

order3 <- c(1,4,7,10,2,5,8,11,3,6,9,12,13,16,19,22,14,17,20,23,15,18,21,24)
or
order4 <- c(24,21,18,15,23,20,17,14,22,19,16,13,12,9,6,3,11,8,5,2,10,7,4,1)

The heatmap is reordered but NOT how I have specified:
The actual order it returns in either case is the same:

1,5,9,2,6,10,3,7,11,4,8,12,13,17,21,14,18,22,15,19,23,16,20,24 which I'm 
completely confused about as I'm not plotting a dendrogram for the rows
or letting the heatmap function draw its own so where is it getting the 
order from ? and is it possible to plot it like I'm trying to ?

My second question is also from the gregmisc package
I'm using bluered600 <- bluered(600) to specify the range of colors plotted
my data ranges from -60 to +80 but I would like to specify that the 
colours range from blue to red with white being zero
however because of the unequal distribution zero is shifted into the red 
area (hope that makes sense)
I know I can specify colors for "low" "medium" and "high", in some 
graphics functions but this isn't what I'm trying to do
unless my data is evenly distributed i.e -60 to +60 I can't plot exactly 
how I want to


If anyone has any ideas that would be fantastic

Cheers

Jason


-- 
--------------------------------
Jason Skelton
Pathogen Microarrays
Wellcome Trust Sanger Institute
Hinxton
Cambridge
CB10 1SA

Tel +44(0)1223 834244 Ext 7123
Fax +44(0)1223 494919




More information about the R-help mailing list