adjust_dend_by_leaf_width: Adjust dendrogram based on width of leaves

Description Usage Arguments Details Value Author(s) Examples

Description

Adjust dendrogram based on width of leaves

Usage

1

Arguments

dend

a dendrogram object.

width

a vector of width. The order of width SHOULD be same as the order of original elements before clustering.

offset

offset to x = 0

Details

In the standard dendrogram object, leaves locate at x = 0.5, 1.5, ..., n - 0.5, which means, the width of leaves are always 1 and the distance to neighbouring leaves is always 1 as well. Here adjust_dend_by_leaf_width adjusts the dendrogram by setting different width for leaves so that leaves have unequal distance to other leaves.

The adjusted dendrogram can be sent to grid.dendrogram2 to make the dendrogram.

For each branch as well each leaf, a new attribute of x is added which is the position of the middle point or the leaf. For each leaf, a new attribute of width is added which is the width of current leaf.

Value

A dendrogram object. The adjustment will not affect other standard dendrogram functions.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1
2
3
4
5
6
7
m = matrix(rnorm(100), 10)
dend = as.dendrogram(hclust(dist(m)))
dend = adjust_dend_by_leaf_width(dend, width = 1:10)
require(dendextend)
get_leaves_attr(dend, "label")
get_leaves_attr(dend, "width")
get_leaves_attr(dend, "x")

eilslabs/ComplexHeatmap documentation built on May 16, 2019, 1:21 a.m.