valueToColor
takes a numerical vector and maps each value
to an R color string.
numeric
vector with values to be mapped to colors.
numeric(2)
giving the range of values to be mapped to colors.
By default, this will be the range of finite values in x
.
vector with R colors defining the palette (must be a valid argument
to col2rgb
.
Single R color to use for NA
values in x
.
NULL
(default) or numeric(1)
between 0 and 255,
giving the alpha channel value for the colors (0 = fully transparent, 255 = fully opaque).
NULL
will use fully opaque colors (alpha = 255
). alpha
is
ignored if col
already contain colors with defined alpha values.
A character
vector of the same length of x
with
R colors in hexadecimal string-encoded RGB format.
The values in [rng[1], rng[2]]
will be linearly mapped to the
color palette defined by col
. Any values in x
less (greater)
than rng[1]
(rng[2]
) will be assigned the same color as
rng[1]
(rng[2]
).