Learn R Programming

dendextend (version 1.18.1)

flatten.dendrogram: Flatten the branches of a dendrogram's root

Description

The function makes sure the two branches of the root of a dendrogram will have the same height. The user can choose how to decide which height to use.

Usage

flatten.dendrogram(dend, FUN = max, new_height, ...)

Value

A dendrogram with both of the root's branches of the same height

Arguments

dend

dendrogram object

FUN

how to choose the new height of both branches (defaults to taking the max between the two)

new_height

overrides FUN, and sets the new height of the two branches manually

...

passed on (not used)

Examples

Run this code
hc <- hclust(dist(USArrests[2:9, ]), "com")
dend <- as.dendrogram(hc)
attr(dend[[1]], "height") <- 150 # make the height un-equal

par(mfrow = c(1, 2))
plot(dend, main = "original tree")
plot(flatten.dendrogram(dend), main = "Raised tree")

Run the code above in your browser using DataLab