[BioC] Adding a text label to the classvec colour bar in heatplot

Aedin Culhane aedin at jimmy.harvard.edu
Fri Jul 25 01:01:44 CEST 2008

Dear Amy
Do you want to add a group text label on each sample, or just over the 
colorbar on the side ?  The label on each sample is easy  to do. Do you 
want code for this?

However currently I haven't implemented a group text label on colorbars 
in heatplot.  I don't think its available in  heatmap or heatmap.2.

Another function, we have called pretty.dend draws multiple colorbars 
beneath a clustering dendrogram and these colorbars have group labels. 
In the development version I used mtext to add the group labels to the 
side of the color bar and this is prettier  than the function in the 
current release.

Unfortunately I haven't implemented group labels adjacent to the 
colorbar in heatplot as I would have to write code that doesn't call 

Let me know if you find an alternative work around, or if you need me to 
modify heatplot.

I can send you the development version of pretty.dend so you can see 
what the output looks like. The output from a modified version of 
heatplot would look very similar (but has the option of including a 


(and.. BioC developers... I know I should modify pretty.dend so it 
doesn't have a . in the function name... sorry, my mistake, its on my 
to-do list ;-)

Dear BioCs,

I'm trying to create a heat plot with a matrix containing real time PCR data for just 5 genes.  There are 105 samples, belonging to 7 groups (groups are in numerical order).  The matrix looks like this (Age is my grouping variable):

                   Gene1        Gene2       Gene3      Gene4       Gene5        Age
A1R_D03  -13.71434 -14.19288 -15.79439 -14.93712 -14.87174   3
A4R_D03  -13.29068 -13.39888 -16.49077 -14.87276 -15.21852   3
A7R_D03  -13.19423 -13.09508 -15.80787 -14.59671 -14.47190   3
A10R_D03 -13.33472 -13.34051 -15.60396 -14.69521 -14.28135   3
A13R_D03 -11.89260 -11.73026 -16.05069 -14.59895 -16.40680   3
A61K_D03 -14.64341 -14.55358 -16.37900 -15.44644 -15.80778   3


As there are so many samples, it doesn't make sense to have the individual sample names on the graph, so I would like to have the samples in their group order with just the seven group labels.  With heatplot I can get the colourbar for my seven groups using the classvec argument, but can't find any way to label the colourbars with text...

Also, I'm a little confused about the re-ordering that heatplot does - how can I be sure that the samples belonging to a particular group are underneath the appropriate colourbar (and given my situation I would also want the groups to appear in numerical order)?

I have tried using heatmap.2 as well, but it seems only heatplot has the colour bar by group option - heatmap.2 only allows you to add a colourbar representing each column separately?

Here is my code:

#(Ngenet is a transposition of my matrix and the Age variable is in a separate dataframe so that it doesn't appear directly on the plot).

> >heatplot(Ngenet, dend="none", cols.default=FALSE, margin=c(7, 7), labCol=FALSE, lowcol="red", highcol="green", scale="none",  classvec=Mop$Age)

If anyone could suggest how I might add the group labels, I'd be very grateful - appologies if this is something very simple, I have actually seen papers with plots showing exactly what I want to do but just can't figure out how to do it.

With best wishes,

Aedín Culhane,
Research Associate
Computational Biology and Functional Genomics Laboratory
Harvard School of Public Health, Dana-Farber Cancer Institute

44 Binney Street, SM822C
Department of Biostatistics and Computational Biology,
Dana-Farber Cancer Institute
Boston, MA 02115

Phone: +1 (617) 632 2468
Fax:   +1 (617) 582 7760
Email: aedin at jimmy.harvard.edu
Web URL: http://www.hsph.harvard.edu/researchers/aculhane.html

More information about the Bioconductor mailing list