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

alter_graphic

Automatically generate alter_fun


Description

Automatically generate alter_fun

Usage

alter_graphic(graphic = c("rect", "point"),
    width = 1, height = 1,
    horiz_margin = unit(1, "pt"), vertical_margin = unit(1, "pt"),
    fill = "red", col = NA, pch = 16, ...)

Arguments

graphic

Graphic to draw.

width

Relative width of the rectangle.

height

Relative height of the rectangle.

horiz_margin

Horizontal margin. E.g. if you want 1mm margin on top and 1mm margin at bottom of the rectangle, set this value to unit(1, 'mm').

vertical_margin

Vertical margin.

fill

Filled color.

col

Border color.

pch

Pch for points

...

Pass to gpar

Details

This function aims to simplify the definition of functions in alter_fun. Now it only supports rectangles and points.

Examples

mat = read.table(textConnection(
"s1,s2,s3
g1,snv;indel,snv,indel
g2,,snv;indel,snv
g3,snv,,indel;snv"), row.names = 1, header = TRUE, sep = ",", stringsAsFactors = FALSE)
mat = as.matrix(mat)
col = c(snv = "red", indel = "blue")

oncoPrint(mat, 
	alter_fun = list(
		snv = alter_graphic("rect", width = 0.9, height = 0.9, fill = col["snv"]),
		indel = alter_graphic("rect", width = 0.9, height = 0.9, fill = col["indel"])
	), col = col)

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.