[R] Help with hclust() and plot()

Sundar Dorai-Raj sundar.dorai-raj at PDF.COM
Thu May 20 17:49:25 CEST 2004



michael watson (IAH-C) wrote:
> Hi
> 
> When I use plot(hclust(dist..)...)...) etc to create a dendrogram of a
> hierarchial cluster analysis, I end up with a vertical tree.  What do I
> need to do to get a horizontal tree?
> 
> Also, my users are used to seeing trees who's leaves all "end" at the
> same place (eg. Like in minitab).  Is this possible in R?
> 
> Thanks
> 
> Mick
> 

Mick,
   If you use as.dendrogram first then the plot method for dendrograms 
has a horizontal option:

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

This also puts the leave at the end.

R version 1.9.0, 2004-05-06
Windows 2000

--sundar




More information about the R-help mailing list