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

Mikhail, Amy a.mikhail at abdn.ac.uk
Thu Jul 24 04:03:10 CEST 2008

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,

Amy Mikhail
Research student
Parasite and Vector Biology group
University of Aberdeen
Zoology Building
Tillydrone Avenue
AB24 2TZ
Email: a.mikhail at abdn.ac.uk
Phone: 00-44-1224-273256 (office)

The University of Aberdeen is a charity registered in Scotland, No SC013683.

More information about the Bioconductor mailing list