[BioC] Color in the leafs of a dendrogram?

Johan Lindberg johanl at biotech.kth.se
Mon Nov 1 16:58:33 CET 2004

Hmm... I cannot find any way of coloring the leafs after reading
help(dendrogram) or looking at the examples. Ok, you can put in
different symbols (and put color to them) for the different levels but
that was not what I wanted to do. I want to color the leafs of the
dendrogram after the different groups that I have in my data. Then it is
really easy to see which goes where and which deviate. Currently I am
doing this afterwards by saving the image as a postscript file and
altering it.

My situation is like this. I have a matrix of expressionvalues. There
are 3 patients with 3 hybridizations each. When I plot the matrix with
the help of 

sampdist <- dist(t(matrix), method="euclidean")
sclus <- hclust(sampdist, method="average")
plot(sclus, cex=0.7)

then my colnames(matrix) will be plotted as leafs. It is those that I
want to give different colors. How do I do this?

Best regards

// Johan Lindberg

-----Original Message-----
From: Martin Maechler [mailto:maechler at stat.math.ethz.ch] 
Sent: Thursday, October 28, 2004 10:34 AM
To: Johan Lindberg
Cc: bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] Color in the lefs of a dendrogram?


>>>>> "Johan" == Johan Lindberg <johanl at biotech.kth.se>
>>>>>     on Wed, 27 Oct 2004 10:14:57 +0200 writes:

    Johan> Hi all. I have a question of how to put color in a plot of a
    Johan> hierarchical clustering that I have done with 24 microarrays
in an
    Johan> experiment. The basic code that I use to plot:
    Johan> sampdist <- dist(t(Mmatrix), method="euclidean")
    Johan> sclus <- hclust(sampdist, method="average")
    Johan> plot(sclus, cex=0.7)

Use   dclus <- as.dendrogram(sclus)

and -- after reading  help(dendrogram)
    and maybe executing  example(dendrogram)
use   plot(dclus, ......................)

Martin Maechler, ETH Zurich

More information about the Bioconductor mailing list