anno_density {ComplexHeatmap} | R Documentation

## Using kernel density as annotation

### Description

Using kernel density as annotation

### Usage

    anno_density(x, which = c("column", "row"), gp = gpar(fill = "#CCCCCC"),
        type = c("lines", "violin", "heatmap"), ...)

### Arguments

`x` | a matrix or a list. If `x` is a matrix and if `which` is `column`, statistics for density is calculated by columns, if `which` is `row`, the calculation is by rows.
`which` | is the annotation a column annotation or a row annotation?
`gp` | graphic parameters. Note it is ignored if `type` equals to `heatmap`.
`type` | which type of graphics is used to represent density distribution.
`...` | pass to `density`

### Value

A graphic function which can be set in `HeatmapAnnotation` constructor method.

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### Examples

    mat = matrix(rnorm(32), nrow = 4)
    f = anno_density(mat)
    grid.newpage(); f(1:8)

    f = anno_density(mat, which = "row", type = "violin")
    grid.newpage(); f(1:4)

    lt = lapply(1:4, function(i) rnorm(8))
    f = anno_density(lt, type = "heatmap")
    grid.newpage(); f(1:4)

[Package ComplexHeatmap version 1.18.1 Index]