[R] Coloured label, terminal branch and bars in dendograms

About this list Date view Thread view Subject view Author view Attachment view

From: Adaikalavan Ramasamy (gisar@nus.edu.sg)
Date: Tue 17 Dec 2002 - 21:42:16 EST


Message-id: <024D6AEFCB92CB47BA1085751D184BB80105F1D7@MBXSRV03.stf.nus.edu.sg>

Dear R-help,

I have performed a hierarchical clustering on some data that I have and
would like to know some nice ways of visualizing it. I have 2 related
questions:

i) How to color the labels AND the terminal branch of a dendogram? This
is my inelegant way of just getting the colored labels.

data(iris) # Formatting data into required format
ir <- iris[ ,-5]
ir.class <- c( rep("s", 50), rep("c", 50), rep("v", 50))

ir.hclust <- hclust( dist(ir), "average" ) # Hierarchical clustering

plclust(ir.hclust, label =rep("", 150)) # could also set hang=-1
option
mtext(ir.class[ir.hclust$order], side=1, col=
ir.fac.class[ir.hclust$order], at=1:150, line=-2)

This does not color the terminal branch and does not work very well if I
wish to cluster 400 - 500 objects as the text gets very cramped (even
after cex and las option).

ii) I also wish to investigate if the data is clustered according to
several suspected factors/prognosis. Therefore I want to plot these as
'color filled bars' underneath the dendogram (akin to those published
microarray clustering papers).

My way of doing this is to use mtext with "-" as follows:

plclust(ir.hclust)
mtext( "-", side=1, col=ir.var1[ir.hclust$order], at=1:150, line=-1)
mtext( "-", side=1, col=ir.var2[ir.hclust$order], at=1:150, line=-1.5)

Any help or reference is greatly appreciated.

Thanks, Adai.

______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jun 2004 - 09:31:57 EST