Description Usage Arguments Details Value
as.hex()
converts a value in the RGB (red-green-blue) or
HSL (hue-saturation-lightness) color model to a hexadecimal code that can
be reliably recognized by various plotting functions
(e.g., base graphics or ggplot).
1 | as.hex(x)
|
x |
An integer or numeric vector with 3 elements. An integer vector is assumed to be a value in the RGB color model; a numeric vector is assumed to be a value in the HSL color model. |
If x
is an integer vector, then it is assumed that x
denotes
a value in the RGB color model—i.e., that the elements of x
are
integers in between 0 and 255 that specify the values of the red, green,
and blue beams, respectively.
If x
is a numeric vector (but not an integer vector), then it is
assumed that x
denotes a value in the HSL color model—i.e.,
that the first element of x
is an whole number between 0 and 359,
denoting the angle of the hue on the color wheel;
that the second element is a floating point number (to 2 decimal places)
between 0 and 1, denoting the saturation proportion;
that the third element is a floating point number (to 2 decimal places)
between 0 and 1, denoting the lightness proportion.
as.hex()
is not vectorized; hence, x
should denote a single
value in either the RGB or HSL color models.
A character string, the hexadecimal code for a value in the RGB
color model. A hexadecimal code has the form: '#RRGGBB'
, where the
substrings 'RR'
, 'GG'
, and 'BB'
denote the values of
the red, green, and blue beams, respectively, in the RGB color model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.