rect.hclust: Draw Rectangles Around Hierarchical Clusters
Draws rectangles around the branches of a dendrogram highlighting the
corresponding clusters. First the dendrogram is cut at a certain
level, then a rectangle is drawn around selected branches.
rect.hclust(tree, k = NULL, which = NULL, x = NULL, h = NULL,
border = 2, cluster = NULL)
an object of the type produced by hclust.
Scalar. Cut the dendrogram such that either exactly
k clusters are produced or by cutting at height h.
A vector selecting the clusters around which a
rectangle should be drawn. which selects clusters by number
(from left to right in the tree), x selects clusters
containing the respective horizontal coordinates. Default is
which = 1:k.
Vector with border colors for the rectangles.
Optional vector with cluster memberships as returned by
cutree(hclust.obj, k = k), can be specified for efficiency if
(Invisibly) returns a list where each element contains a vector of
data points contained in the respective cluster.