HeatmapAnnotation: Constructor method for HeatmapAnnotation class

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Constructor method for HeatmapAnnotation class

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
HeatmapAnnotation(df, name, col, na_col = "grey",
    annotation_legend_param = list(),
    show_legend = TRUE,
    ...,
    which = c("column", "row"),
    annotation_height = 1,
    annotation_width = 1,
    height = calc_anno_size(),
    width = calc_anno_size(),
    gp = gpar(col = NA),
    gap = unit(0, "mm"),
    show_annotation_name = FALSE,
    annotation_name_gp = gpar(),
    annotation_name_offset = unit(2, "mm"),
    annotation_name_side = ifelse(which == "column", "right", "bottom"),
    annotation_name_rot = ifelse(which == "column", 0, 90))

Arguments

df

a data frame. Each column will be treated as a simple annotation. The data frame must have column names.

name

name of the heatmap annotation, optional.

col

a list of colors which contains color mapping to columns in df. See SingleAnnotation for how to set colors.

na_col

color for NA values in simple annotations.

annotation_legend_param

a list which contains parameters for annotation legends

show_legend

whether show legend for each column in df.

...

functions which define complex annotations or vectors of simple annotation. Values should be named arguments.

which

are the annotations row annotations or column annotations?

annotation_height

height of each annotation if annotations are column annotations.

annotation_width

width of each annotation if annotations are row annotations.

height

height of the column annotations, basically it is identical to bottom_annotation_height or top_annotation_height in Heatmap function.

width

width of the whole heatmap annotations, only used for row annotation when appending to the list of heatmaps.

gp

graphic parameters for simple annotations.

gap

gap between each annotation

show_annotation_name

whether show annotation names. For column annotation, annotation names are drawn either on the left or the right, and for row annotations, names are draw either on top to at bottom. The value can be a vector.

annotation_name_gp

graphic parameters for anntation names. Graphic paramters can be vectors.

annotation_name_offset

offset to the annotations, unit object. The value can be a vector.

annotation_name_side

side of the annotation names.

annotation_name_rot

rotation of the annotation names, can only take values in c(00, 90, 180, 270). The value can be a vector.

Details

The simple annotations are defined by df and col arguments. Complex annotations are defined by the function list. So you need to at least to define df or a annotation function.

Value

A HeatmapAnnotation-class object.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

See Also

There are two shortcut functions: rowAnnotation and columnAnnotation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
ha = HeatmapAnnotation(df = df)

ha = HeatmapAnnotation(df = df, col = list(type = c("a" =  "red", "b" = "blue")))
ha = HeatmapAnnotation(type = c("a", "a", "a", "b", "b", "b"), 
    col = list(type = c("a" =  "red", "b" = "blue")))

ha = HeatmapAnnotation(df = df, col = list(type = c("a" =  "red", "b" = "blue")), 
    which = "row")

ha = HeatmapAnnotation(points = anno_points(1:6))

ha = HeatmapAnnotation(histogram = anno_points(1:6))

mat = matrix(rnorm(36), 6)
ha = HeatmapAnnotation(boxplot = anno_boxplot(mat))

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