alter_graphic {ComplexHeatmap} | R Documentation

## 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)

[Package ComplexHeatmap version 2.10.0 Index]