color_mapping_legend-ColorMapping-method {ComplexHeatmap} | R Documentation

## Draw Legend Based on Color Mapping

### Description

Draw Legend Based on Color Mapping

### Usage

    ## S4 method for signature 'ColorMapping'
    color_mapping_legend(object,
        plot = TRUE, ...,

        color_bar = object@type,

        title = object@name,
        title_gp = gpar(fontsize = 10, fontface = "bold"),
        title_position = "topleft",
        grid_height = unit(4, "mm"),
        grid_width = unit(4, "mm"),
        border = NULL,
        at = object@levels,
        labels = at,
        labels_gp = gpar(fontsize = 10),
        labels_rot = 0,
        nrow = NULL,
        ncol = 1,
        by_row = FALSE,
        legend_height = NULL,
        legend_width = NULL,
        legend_direction = c("vertical", "horizontal"),

        param = NULL)

### Arguments

`object` | A `ColorMapping-class` object.
`plot` | Whether to plot or just return the legend object?
`...` | Pass to `draw,Legends-method`.
`color_bar` | "continous" or "discrete". It controls whether to show the discrete legend for the continuous color mapping.
`title` | Title of the legend, by default it is the name of the legend.
`title_gp` | Graphical parameters for legend title.
`title_position` | Position of the title. See `Legend` for all possible values.
`grid_height` | Height of each legend grid. Pass to `Legend`.
`grid_width` | Width of each legend grid. Pass to `Legend`.
`border` | Color for legend grid borders. Pass to `Legend`.
`at` | Break values of the legend. By default it is the levels in the `ColorMapping-class` object.
`labels` | Labels corresponding to break values.
`labels_gp` | Graphcial parameters for legend labels.
`labels_rot` | Rotation of labels.
`nrow` | Pass to `Legend`. It controls the layout of legend grids if they are arranged in multiple rows or columns.
`ncol` | Pass to `Legend`. It controls the layout of legend grids if they are arranged in multiple rows or columns.
`by_row` | Pass to `Legend`. It controls the order of legend grids if they are arranged in multiple rows or columns.
`legend_height` | Height of the legend body. It only works when `color_bar` is `continuous` and `direction` is `vertical`. Pass to `Legend`.
`legend_width` | Width of the legend body. It only works when `color_bar` is `continuous` and `direction` is `horizontal`. Pass to `Legend`.
`legend_direction` | When `color_bar` is `continuous`, whether the legend is vertical or horizontal? Pass to `Legend`.
`param` | All the legend-related parameters can be specified as a single list.

### Details

The legend is constructed by `Legend`.

### Value

A `Legends-class` object.

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### Examples

    # There is no example
    NULL

[Package ComplexHeatmap version 2.3.4 Index]