decorate_heatmap_body: Decorate the heatmap body

Description Usage Arguments Details Value Author(s) Examples

Description

Decorate the heatmap body

Usage

1
decorate_heatmap_body(heatmap, code, slice = 1, envir = new.env(parent = parent.frame()))

Arguments

heatmap

name of the heatmap which is set as name option in Heatmap function

code

code that adds graphics in the selected heatmap body

slice

index of row slices in the heatmap if it is split by rows

envir

where to look for variables inside code

Details

There is a viewport for each row slice in each 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 number of rows and columns for that row slice, it is simple to calculate the position of every small grid in the row slice. E.g., the position for the grid in i^th row and j^th column is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    # assume nc is the number of columns 
    # and nr is the number of rows in that row slice
    unit((i-0.5)/nc, "npc")
    unit((j-0.5)/nr, "npc")

    # the width is
    unit(1/nc, "npc")

    # the height is
    unit(1/nr, "npc")  

Value

This function returns no value.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1
2
3
4
5
set.seed(123)
Heatmap(matrix(rnorm(100), 10), name = "mat")
decorate_heatmap_body("mat", {
    grid.circle(gp = gpar(fill = "#FF000080"))
})

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