Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

decorate_dimnames

Decorate Heatmap Dimension Names


Description

Decorate Heatmap Dimension Names

Usage

decorate_dimnames(heatmap, code, slice = 1, which = c("column", "row"),
    envir = new.env(parent = parent.frame()))

Arguments

heatmap

Name of the heatmap.

code

Code that adds graphics in the selected viewport.

slice

Index of the row slice or column slice in the heatmap.

which

on rows or on columns?

envir

where to look for variables inside code.

Details

If you know the dimensions of the matrix, it is simple to calculate the position of every row name or column name in the heatmap. E.g., for the column column, the i^th name is located at:

# assume nc is the number of columns in the column slice
    unit((i-0.5)/nc, "npc")

Value

The function returns no value.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

set.seed(123)
mat = matrix(rnorm(100), 10)
rownames(mat) = letters[1:10]
colnames(mat) = LETTERS[1:10]
Heatmap(mat, name = "mat", km = 2)

decorate_dimnames("mat", {
    grid.rect(gp = gpar(fill = "#FF000080"))
}, which = "row", slice = 2)

ComplexHeatmap

Make Complex Heatmaps

v2.6.2
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2020-11-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.