[R] plot.dendrogram

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Wed Sep 8 15:49:07 CEST 2004

Try setting something like "cex=0.5" in the plot. It works for at least
hclust. Here is a quick example using hclust to show how you can get
away with set the colours.

hc <- hclust(dist(USArrests), "ave")

plot(hc, hang=-1, cex=0.5)
labels <- rownames(USArrests)[ hc$order]; n <- length(labels)
mtext(labels, side=1, at=1:n, las=2, col=1:n, cex=0.5, line=0)

If you want to get rid of the double labelling (which is useful for
checking), then set "labels=FALSE" in the plot().

The trick now becomes how to generalise this to other dendrogram and
when "hang=-1" is not the case. 

My initial though was to look into plot.hclust to see how the coordinate
for label placement was calculated and replace it with text(...,
col=col.label). But it appears that this is done with a ".Internal"
function and I have not learned how to read/edit this yet.

On Wed, 2004-09-08 at 11:06, Marta Rufino wrote:
> Dear R-users,
> I would like to change the labels size and format in the node ends of a dendrogram, how can I do it?
> How can I use different symbols/colors in each node ends ?
> I manage to do it with plot.cluster, but heat map uses plot.dendrogram.
> Can anyone help me please?
> thank you
> Marta
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list