grid.dendrogram: Draw dendrogram under grid system

Description Usage Arguments Details Value Author(s) Examples

Description

Draw dendrogram under grid system

Usage

1
2
grid.dendrogram(dend, facing = c("bottom", "top", "left", "right"),
    max_height = NULL, order = c("normal", "reverse"), ...)

Arguments

dend

a dendrogram object.

facing

facing of the dendrogram.

max_height

maximum height of the dendrogram. It is useful to make dendrograms comparable if you want to plot more than one dendrograms. Height for each dendrogram can be obtained by attr(dend, "height").

order

should leaves of dendrogram be put in the normal order (1, ..., n) or reverse order (n, ..., 1)? It may matters for the dendrograms putting on left and right.

...

pass to viewport which contains the dendrogram.

Details

The dendrogram can be renderred (e.g. by dendextend package).

A viewport is created which contains the dendrogram.

This function only plots the dendrogram without adding labels. The leaves of the dendrogram locates at unit(c(0.5, 1.5, ...(n-0.5))/n, "npc").

Value

No value is returned.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
hc = hclust(dist(USArrests[1:5, ]))
dend = as.dendrogram(hc)

grid.newpage()
layout = grid.layout(nrow = 2, ncol = 2)
pushViewport(viewport(layout = layout))
grid.dendrogram(dend, layout.pos.row = 1, layout.pos.col = 1)
grid.dendrogram(dend, facing = "top", layout.pos.row = 1, layout.pos.col = 2)
grid.dendrogram(dend, facing = "top", order = "reverse", layout.pos.row = 2, 
    layout.pos.col = 1)
grid.dendrogram(dend, facing = "left", layout.pos.row = 2, layout.pos.col = 2)
upViewport()

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