[R] gplot heatmaps: clustering according to rowsidecolors + key.xtickfun

Tim Richter-Heitmann trichter at uni-bremen.de
Thu Sep 4 15:23:54 CEST 2014

Hi there,

I have two questions about heatmap.2 in gplot.
My input is a simple square matrix with numeric values between 75 and 
100 (it is a similarity matrix based on bacterial DNA sequences).

1. I can sort my input matrix into categories with rowsidecolors (in 
this case, very conveniently by bacterial taxa). I do a clustering and 
reordering of my matrix by Rowv=TRUE (and Colv="Rowv").
The question is now, can i combine the two features that the 
clustering/reordering is done only for submatrices defined by the 
vectors given in rowsidecolors (so, in this case, that the original 
ordering by bacterial taxa is preserved)?

That would be very amazing.

2. I have set my own coloring rules with:

mypal <- c("grey","blue", "green","yellow","orange","red")
col_breaks = c(seq(0,74.9), seq(75.0,78.4), seq(78.5,81.9), 
seq(82.0,86.4), seq(86.5, 94.5),  seq(94.5,100.0))

Is it possible to pass this sequential ordering to key.xtickfun? May i 
ask for an example code?

Thank you very much!

Tim Richter-Heitmann (M.Sc.)
PhD Candidate

International Max-Planck Research School for Marine Microbiology
University of Bremen
Microbial Ecophysiology Group (AG Friedrich)
FB02 - Biologie/Chemie
Leobener Straße (NW2 A2130)
D-28359 Bremen
Tel.: 0049(0)421 218-63062
Fax: 0049(0)421 218-63069

More information about the R-help mailing list