draw.dendrogram {NeatMap}R Documentation

Draws a dendrogram in 2d

Description

Draw a dendrogram in 2d given clustering results. Leaf order may be specified, allowing comparison to clustering result.

Usage

draw.dendrogram(cluster, leaf.order=NULL, scale = 10, dendro.dir = "left", 
order.dir = "up", origin = as.vector(c(0.5, 0)), heights = NULL)

Arguments

cluster Hierarchical clustering result of type hclust to be plotted.
leaf.order A vector containing the order of leaf tips, if NULL, the order specified in cluster is used
scale Maximum dendrogram height. Width is equal to number of leaves
dendro.dir Direction in which the leaves point. One of "up", "down", "left" or "right"
order.dir Direction in which leaves are ordered. Should be perpendicular to dendro.dir. One of"up", "down", "left" or "right"
origin Position of first leaf
heights A vector of heights, which may be used to over-ride the height information included in cluster (which are used by default if this is NULL)

Details

Similar to the plot command for cluster results of type hclust. Primarily intended for internal use, but for ease of formatting, may be of use in producing standard dendrogram plots instead of the standard hclust commands. Also the leaf order, and branch heights used here may be different from that specified in cluster. The leaf tips are placed at the integer valued positions (with respect to the origin) specified in the leaf order. This may be used to place labels, colored points etc at the leaf tips.

Value

a ggplot layer

Note

The leaf heights are scaled so that the maximum height corresponds to scale.

Author(s)

Satwik Rajaram and Yoshi Oono

See Also

hclust.

Examples

#compare complete and average linkage
mtcars.cluster<-hclust(dist(mtcars),method="complete")
mtcars.cluster.avg<-hclust(dist(mtcars),method="average")
#ggplot.default()+draw.dendrogram(mtcars.cluster,leaf.order=mtcars.cluster.avg$order)
qplot(x=0,y=0)+draw.dendrogram(mtcars.cluster,leaf.order=mtcars.cluster.avg$order)


[Package NeatMap version 0.3.2 Index]