anno_simple: Simple Annotation

Description Usage Arguments Details Value See Also Examples

View source: R/AnnotationFunction-function.R

Description

Simple Annotation

Usage

1
2
3
4
5
anno_simple(x, col, na_col = "grey",
    which = c("column", "row"), border = FALSE, gp = gpar(col = NA),
    pch = NULL, pt_size = unit(1, "snpc")*0.8, pt_gp = gpar(),
    simple_anno_size = ht_opt$simple_anno_size,
    width = NULL, height = NULL)

Arguments

x

The value vector. The value can be a vector or a matrix. The length of the vector or the nrow of the matrix is taken as the number of the observations of the annotation. The value can be numeric or character and NA value is allowed.

col

Color that maps to x. If x is numeric and needs a continuous mapping, col should be a color mapping function which accepts a vector of values and returns a vector of colors. Normally it is generated by colorRamp2. If x is discrete (numeric or character) and needs a discrete color mapping, col should be a vector of colors with levels in x as vector names. If col is not specified, the color mapping is randomly generated by ComplexHeatmap:::default_col.

na_col

Color for NA value.

which

Whether it is a column annotation or a row annotation?

border

Wether draw borders of the annotation region?

gp

Graphic parameters for grid borders. The fill parameter is disabled.

pch

Points/symbols that are added on top of the annotation grids. The value can be numeric or single letters. It can be a vector if x is a vector and a matrix if x is a matrix. No points are drawn if the corresponding values are NA.

pt_size

Size of the points/symbols. It should be a unit object. If x is a vector, the value of pt_size can be a vector, while if x is a matrix, pt_size can only be a single value.

pt_gp

Graphic parameters for points/symbols. The length setting is same as pt_size. If pch is set as letters, the fontsize should be set as pt_gp = gpar(fontsize = ...).

simple_anno_size

size of the simple annotation.

width

Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.

height

Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.

Details

The "simple annotation" is the most widely used annotation type which is heatmap-like, where the grid colors correspond to the values. anno_simple also supports to add points/symbols on top of the grids where the it can be normal point (when pch is set as numbers) or letters (when pch is set as single letters).

Value

An annotation function which can be used in HeatmapAnnotation.

See Also

https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#simple-annotation-as-an-annotation-function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
anno = anno_simple(1:10)
draw(anno, test = "a numeric vector")

anno = anno_simple(cbind(1:10, 10:1))
draw(anno, test = "a matrix")

anno = anno_simple(1:10, pch = c(1:4, NA, 6:8, NA, 10))
draw(anno, test = "pch has NA values")

anno = anno_simple(1:10, pch = c(rep("A", 5), rep(NA, 5)))
draw(anno, test = "pch has NA values")

pch = matrix(1:20, nc = 2)
pch[sample(length(pch), 10)] = NA
anno = anno_simple(cbind(1:10, 10:1), pch = pch)
draw(anno, test = "matrix, pch is a matrix with NA values")

ComplexHeatmap documentation built on Nov. 14, 2020, 2:01 a.m.