Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

map_to_colors-ColorMapping-method

Map Values to Colors


Description

Map Values to Colors

Usage

## S4 method for signature 'ColorMapping'
map_to_colors(object, x)

Arguments

object

A ColorMapping-class object.

x

Input values.

Details

It maps a vector of values to a vector of colors.

This function provides a uniform way for discrete and continuous color mapping.

Value

A vector of colors.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

cm = ColorMapping(colors = c("A" = "red", "B" = "black"))
map_to_colors(cm, sample(c("A", "B"), 10, replace = TRUE))
require(circlize)
col_fun = colorRamp2(c(0, 1), c("white", "red"))
cm = ColorMapping(col_fun = col_fun)
map_to_colors(cm, runif(10))

ComplexHeatmap

Make Complex Heatmaps

v2.6.2
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2020-11-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.