polar.clust: Convert a hclust object to a polar dendrogram

Description Usage Arguments Value Author(s) See Also Examples

Description

Any hclust object can be converted to a polar dendrogram using this function and then plotted with the standard graphics functions.

Usage

1
2
polar.clust(x, labels = sprintf("#%i", 1:length(x$order)), col,
  padding = 0.01, hang = 0.1 * max(x$height))

Arguments

x

hclust object.

labels

Chraracter vector of leaf labels.

col

Vector of leaf colours.

padding

Spacing between branches.

hang

Branch lengths of the leaves.

Value

An object of class polar.clust

Author(s)

Christofer Bäcklin

See Also

plot.polar.clust

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
my.data <- iris[-5] + .5*matrix(rnorm(nrow(iris)*(ncol(iris)-1)), nrow(iris))
cl <- hclust(dist(my.data))
x <- polar.clust(cl)

plot(x)

# Color according to class
labels(x) <- sprintf("%s %i", iris$Species, 1:150)
colors(x) <- iris$Species
plot(x, expand=1.2, label.size=.3, las=2)

# Color according to branch
colors(x) <- c(brewer.pal(6, "Set1"))
labels(x) <- NULL # Clear the current labels
labels(x) <- paste("Branch", 1:6)
plot(x, las=1)

# Manual compilation of the plot
s <- c(.4,2.2)*pi
colors(x) <- NULL
plot(x, type="n", labels=FALSE, axes=FALSE, expand=1.1)
branches(x, k=6, sector=s, fill=TRUE, lwd=10, lightness=.3)
lines(x, sector=s)
points(x, pch=19, sector=s)
legend("topright", paste("Branch", 1:6), fill=brewer.pal(6, "Set1"), bg="white")

backlin/polarClust documentation built on May 11, 2019, 5:23 p.m.