Skip to content
Back to formatted view

Raw Message

Message-ID: <40ACF305.3060408@pdf.com>
Date: 2004-05-20T18:03:49Z
From: Sundar Dorai-Raj
Subject: Help with hclust() and plot()
In-Reply-To: <8975119BCD0AC5419D61A9CF1A923E9516EE50@iahce2knas1.iah.bbsrc.reserved>

michael watson (IAH-C) wrote:

> Hi
> 
> Thanks for that!  BUT if I use as.dendrogram, I can't use my labels
> anymore!
> 
> 
>>plot(hclust(...etc), labels=p[,1])
> 
> 
> Works fine.  But:
> 
> 
>>plot(as.dendrogram(hclust(...etc)), labels=p[,1]) 
> 
> 
> Gives me errors:
> 
> Error in axis(side, at, labels, tick, line, pos, outer, font, vfont,
> lty,  :
> 	location and label lengths differ, 6 != 24
> 
> I have 24 labels.  I have no idea where it gets 6 from!
> 
> My 'dendrogram' has '2 branches and 24 members total'.
> 
> SOOO, how do I get my dendrogram horizontal, or vertical for that
> matter, with useful labels instead of 1,2,3,4,5,etc
> 
> Thanks in advance for your help!
> 
> Mick
> 

Mick,
   Change the labels in hclust first:

data(USArrests)
hc <- hclust(dist(USArrests), "ave")
hc$labels <- 1:50
dend1 <- as.dendrogram(hc)
plot(dend1, horiz = TRUE)

--sundar