ComplexHeatmap (version 1.10.2)

ColorMapping: Constructor methods for ColorMapping class

Description

Constructor methods for ColorMapping class

Usage

ColorMapping(name, colors = NULL, levels = NULL,
    col_fun = NULL, breaks = NULL, na_col = "#FFFFFF")

Arguments

name
name for this color mapping. The name is automatically generated if it is not specified.
colors
discrete colors.
levels
levels that correspond to colors. If colors is name indexed, levels can be ignored.
col_fun
color mapping function that maps continuous values to colors.
breaks
breaks for the continuous color mapping. If col_fun is generated by colorRamp2, breaks can be ignored.
na_col
colors for NA values.

Value

Details

colors and levels are used for discrete color mapping, col_fun and breaks are used for continuous color mapping.

Examples

Run this code
# discrete color mapping for characters
cm = ColorMapping(name = "test",
    colors = c("blue", "white", "red"),
    levels = c("a", "b", "c"))
cm

# discrete color mapping for numeric values
cm = ColorMapping(name = "test",
    colors = c("blue", "white", "red"),
    levels = c(1, 2, 3))
cm

# continuous color mapping
require(circlize)
cm = ColorMapping(name = "test",
    col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red")))
cm

Run the code above in your browser using DataCamp Workspace