Description Usage Arguments Details Value Author(s) Examples
Map Values to Colors
1 2 | ## S4 method for signature 'ColorMapping'
map_to_colors(object, x)
|
object |
A |
x |
Input values. |
It maps a vector of values to a vector of colors.
This function provides a uniform way for discrete and continuous color mapping.
A vector of colors.
Zuguang Gu <z.gu@dkfz.de>
1 2 3 4 5 6 | 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))
|
Loading required package: grid
[1] "#FF0000FF" "#FF0000FF" "#000000FF" "#FF0000FF" "#FF0000FF" "#000000FF"
[7] "#FF0000FF" "#000000FF" "#FF0000FF" "#FF0000FF"
Loading required package: circlize
[1] "#FFC0ACFF" "#FF8565FF" "#FF8060FF" "#FFEAE2FF" "#FFA286FF" "#FF6240FF"
[7] "#FFEBE3FF" "#FF7D5CFF" "#FFD5C7FF" "#FFFFFFFF"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.