packLegend {ComplexHeatmap} | R Documentation

## Pack legends

### Description

Pack legends

### Usage

    packLegend(..., gap = unit(4, "mm"), direction = c("vertical", "horizontal"))

### Arguments

`...` | objects returned by `Legend`
`gap` | gap between two legends. The value is a `unit` object
`direction` | how to arrange legends

### Value

A `grob` object

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### Examples

    lgd1 = Legend(title = "discrete", at = 1:4, labels = letters[1:4],
    	legend_gp = gpar(fill = 2:5))

    require(circlize)
    col_fun = colorRamp2(c(-1, 0, 1), c("blue", "white", "red"))
    lgd2 = Legend(title = "continuous", at = seq(-1, 1, by = 0.5), col_fun = col_fun)

    pl = packLegend(lgd1, lgd2)
    grid.newpage()
    grid.draw(pl)

    pl = packLegend(lgd1, lgd2, direction = "horizontal")
    grid.newpage()
    grid.draw(pl)

[Package ComplexHeatmap version 1.18.1 Index]