Re: [R] Dendrogram plotting options?

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Mon 19 Jul 2004 - 17:32:50 EST

    Mark> Hi, I was wondering if there is more flexibility in the output of     Mark> dendrograms when plotting a hclust object.

This is becoming a real FAQ.
{Have you tried to find the answer in the searchable "R-help" archives?}

    Mark> dendrograms when plotting a hclust object. I can't seem to find 
    Mark> information on how to change the default output of a "hanging" style 
    Mark> tree with the axis on the right to a left-to-right plot with and axis 
    Mark> on the bottom. Example  code follows:

    Mark> library(vegan) #loads the "vegan" module that compuptes ANOSIM
    Mark> library(cluster)
    Mark> community <- read.csv("ANOSIMmites.csv", header=TRUE) #reads the data

we don't have that file. So why don't you rather use a *reproducible* example as the posting guide (bottom line of every R-help message) tells you to ?

    Mark> <<... hence irrelevant ...>

    Mark> clust <- hclust(community.dist, method = "complete", members=NULL)

    Mark> plot(clust, labels = sample, hang = 0.05, axes = TRUE, frame.plot = 
    Mark>      FALSE, ann = F, main = "Dendrogram of sample similarity", 
    Mark>      sub = "based on associated soil mite species", 
    Mark>      xlab = NULL, ylab = "Height")

"The" answer in principle is

    d.cl <- as.dendrogram(clust, hang = 0.05)## <-- 'hang' must be here

    plot(d.cl, ..................., horiz = TRUE)

and the "R-devel" version allows even quite a few more options to dendrogram plotting than "current R".

Martin Maechler, Seminar fuer Statistik, ETH Zurich



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 19 17:40:33 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:04 EST