Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

anno_simple

Simple Annotation


Description

Simple Annotation

Usage

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

Examples

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

Make Complex Heatmaps

v2.6.2
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2020-11-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.