branches: Color branches of a polar dendrogram

Description Usage Arguments Author(s) Examples

View source: R/polar.clust.R

Description

This function can either draw a line in the margin outside each branch (fill=FALSE) or color the area underneath a branch (fill=TRUE).

Usage

1
2
branches(x, k, h, fill = FALSE, lwd = 20, sector = c(0, 2 * pi), col,
  alpha, lightness)

Arguments

x

polar.clust object.

k

Number of branches to split x into.

h

Height at which to split x.

fill

Annotation style, see the details of this function.

lwd

Line width, should be pretty large to be clearly visible.

sector

See plot.polar.clust.

col

Branch colors. If omitted it will be taken from x (if it has first been specified with colors<-).

alpha

Opacity values (0 is transparent, 1 is opaque).

lightness

Color lightness (0 is the original color, 1 is white, and values in between are interpolated).

Author(s)

Christofer B<c3><a4>cklin

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 June 4, 2017, 12:11 a.m.