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

anno_empty

Empty Annotation


Description

Empty Annotation

Usage

anno_empty(which = c("column", "row"), border = TRUE, zoom = FALSE,
    width = NULL, height = NULL)

Arguments

which

Whether it is a column annotation or a row annotation?

border

Whether draw borders of the annotation region?

zoom

If it is true and when the heatmap is split, the empty annotation slices will have equal height or width, and you can see the correspondance between the annotation slices and the original heatmap slices.

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

It creates an empty annotation and holds space, later users can add graphics by decorate_annotation. This function is useful when users have difficulty to implement AnnotationFunction object.

In following example, an empty annotation is first created and later points are added:

m = matrix(rnorm(100), 10)
	ht = Heatmap(m, top_annotation = HeatmapAnnotation(pt = anno_empty()))
	ht = draw(ht)
	co = column_order(ht)[[1]]
	pt_value = 1:10
	decorate_annotation("pt", {
		pushViewport(viewport(xscale = c(0.5, ncol(mat)+0.5), yscale = range(pt_value)))
		grid.points(seq_len(ncol(mat)), pt_value[co], pch = 16, default.units = "native")
		grid.yaxis()
		popViewport()
	})

And it is similar as using anno_points:

Heatmap(m, top_annotation = HeatmapAnnotation(pt = anno_points(pt_value)))

Value

An annotation function which can be used in HeatmapAnnotation.

See Also

Examples

anno = anno_empty()
draw(anno, test = "anno_empty")
anno = anno_empty(border = FALSE)
draw(anno, test = "anno_empty without border")

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.