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

colorRamp2

Color interpolation


Description

Color interpolation

Usage

colorRamp2(breaks, colors, transparency = 0, space = "LAB")

Arguments

breaks

A vector indicating numeric breaks

colors

A vector of colors which correspond to values in breaks

transparency

A single value in [0, 1]. 0 refers to no transparency and 1 refers to full transparency

space

color space in which colors are interpolated. Value should be one of "RGB", "HSV", "HLS", "LAB", "XYZ", "sRGB", "LUV", see color-class for detail.

Details

Colors are linearly interpolated according to break values and corresponding colors through CIE Lab color space (LAB) by default. Values exceeding breaks will be assigned with corresponding maximum or minimum colors.

Value

It returns a function which accepts a vector of numeric values and returns interpolated colors.

See Also

col2value converts back to the original values by providing the color mapping function generated by colorRamp2.

Examples

col_fun = colorRamp2(c(-1, 0, 1), c("green", "white", "red"))
col_fun(c(-2, -1, -0.5, 0, 0.5, 1, 2))

circlize

Circular Visualization

v0.4.12
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2021-1-8

We don't support your browser anymore

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