Learn R Programming

shipunov (version 1.17.1)

Fence: Colorize tips of 'hclust' plot

Description

Uses segments() and Tcoords() to colorize 'hclust' plot

Usage

Fence(hcl, fct, ex=0.05, lwd=2.5, horiz=FALSE, hang=0.1, ...)

Arguments

hcl

hclust object

fct

Variable to colorize labels, will be converted into factor

ex

The fraction of the plot height by which segments go up and down from the tips; by default, it is half of the 'hang'

lwd

Line width of segments

horiz

Plot on a horizontal tree?

hang

The fraction of the plot height by which labels should hang below the rest of the plot; by default, it is equal to the default 'hang' from hclust which is 0.1

...

Further arguments to segments()

See Also

Tcoords, hclust

Examples

Run this code

iris.h <- hclust(dist(iris[, -5]))
plot(iris.h, labels=FALSE)
Fence(iris.h, iris$Species)
legend("topright", legend=levels(iris$Species), col=1:3, lwd=2.5, bty="n")

Run the code above in your browser using DataLab