# [R] a. crossing branches with hclust, b. plot.dendrogram

Martin Maechler maechler at stat.math.ethz.ch
Mon Sep 29 09:24:35 CEST 2003

```>>>>> "Petra" == Petra Steiner <petra at icsi.berkeley.edu>
>>>>>     on Fri, 26 Sep 2003 15:06:59 -0700 writes:

Petra> Hello, a. when I use hclust with the methods media,
"median"
Petra> centroid, and mcquitty, and plot the results, the
Petra> dendrograms have lines that are crossing each
Petra> other. Is this ok?

yes.  It is known in the litterature that only some methods
(those that are `monotone') are guaranteed to produce
dendrograms without "reversal"s or "inversion"s.   I don't have
the complete theory handy, but I know that "centroid" is known
*not* to fulfill the property and "single", "complete" and

Petra> b. My next question refers to plot.dendrogram: How
Petra> can I use parameters as "hang" or "cex" here?
Petra> E.g. for

Petra> st <- as.dendrogram(subtreeshc[[x]])

The vertical position of nodes is part of the dendrogram
definition,
hence use
st <- as.dendrogram(subtreeshc[[x]],  hang = ...)

Where as "cex" can be specified using `nodePar', see the
examples on help(plot.dendrogram).

Petra> I would like to have something like this, where cex
Petra> and hang would work:

Petra> plot(st, frame.plot=F, cex = 0.4, hang = 0, sub = "",
Petra> xlab = "", ylab="", main = paste("Distance: ", me, "
Petra> - Clustering Method: ", mecl, " - Subtree ", x,
Petra> collapse="", sep=""))

Petra> Thanks and best regards, Petra

You're welcome.
--
Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

```