Learn R Programming

ComplexHeatmap (version 1.10.2)

decorate_dimnames: Decorate the heatmap dimension names

Description

Decorate the heatmap dimension names

Usage

decorate_dimnames(heatmap, code, slice = 1, which = c("column", "row"))

Arguments

heatmap
name of the heatmap
code
code that adds graphics in the selected heatmap body
slice
index of row slices in the heatmap
which
on rows or on columns?

Value

  • The function returns no value.

Details

There is a viewport for row names and column names in the heatmap. This function contructs the name of the viewport, goes to the viewport by seekViewport and applies code to that viewport.

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 unit((i-0.5)/nc, "npc")

Examples

Run this code
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)

Run the code above in your browser using DataLab