colorRamp2 | R Documentation |
Generate color mapping functions
colorRamp2(breaks, colors, transparency = 0, space = "LAB", hcl_palette = NULL, reverse = FALSE)
breaks |
A vector of numeric break values. |
colors |
A vector of colors which correspond to values in |
transparency |
A single value in |
space |
Color space in which colors are interpolated. Value should be one of "RGB", "LAB", "XYZ", "sRGB", "LUV", see |
hcl_palette |
Name of the HCL palette. Value should be supported in |
reverse |
Whether should the colors in |
Colors are linearly interpolated according to the break values and corresponding colors through a certain color space. Values exceeding breaks will be assigned with corresponding maximum or minimum colors.
A function which accepts a vector of numeric values and returns interpolated colors.
col2value
converts back to the original values by providing the color mapping function generated by colorRamp2
.
col_fun = colorRamp2(c(-1, 0, 1), c("green", "white", "red")) col_fun(c(-2, -1, -0.5, 0, 0.5, 1, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.