Learn R Programming

ComplexHeatmap (version 1.10.2)

draw-HeatmapAnnotation-method: Draw the heatmap annotations

Description

Draw the heatmap annotations

Usage

## S3 method for class 'HeatmapAnnotation':
draw(object, index, k = NULL, n = NULL, align_to = "bottom", ...)

Arguments

object
index
a vector of order.
k
if row annotation is splitted, the value identifies which row slice.
n
total number of row slices.
align_to
if the allocated space is more than than the column annotation itself, should the viewport be aligned to the top or bottom?
...
pass to viewport which contains all annotations.

Value

  • No value is returned.

Details

A viewport is created. Mostly, this method is used inside draw,HeatmapList-method.

Examples

Run this code
df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
ha = HeatmapAnnotation(df = df)
grid.newpage(); draw(ha, 1:6)
grid.newpage(); draw(ha, 6:1)

ha = HeatmapAnnotation(df = df, col = list(type = c("a" =  "red", "b" = "blue")))
grid.newpage(); draw(ha, 1:6)

ha = HeatmapAnnotation(df = df, col = list(type = c("a" =  "red", "b" = "blue")), 
    which = "row")
grid.newpage(); draw(ha, 1:6)

ha = HeatmapAnnotation(points = anno_points(1:6))
grid.newpage(); draw(ha, 1:6)

ha = HeatmapAnnotation(histogram = anno_barplot(1:6))
grid.newpage(); draw(ha, 1:6)

mat = matrix(rnorm(36), 6)
ha = HeatmapAnnotation(boxplot = anno_boxplot(mat))
grid.newpage(); draw(ha, 1:6)

Run the code above in your browser using DataLab