Description Usage Arguments Details Value Author(s) Examples

Transform back from colors to values

1 | ```
col2value(r, g, b, col_fun)
``` |

`r` |
red channel in |

`g` |
green channel in |

`b` |
blue channel in |

`col_fun` |
the color mapping function generated by |

`colorRamp2`

transforms values to colors and this function does the reversed job.
Note for some color spaces, it cannot transform back to the original value perfectly.

A vector of original numeric values.

Zuguang Gu <z.gu@dkfz.de>

1 2 3 4 5 6 7 8 9 | ```
x = seq(0, 1, length = 11)
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
col = col_fun(x)
col2value(col, col_fun = col_fun)
col2value("red", col_fun = col_fun)
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"), space = "sRGB")
col = col_fun(x)
col2value(col, col_fun = col_fun)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.