colour_values_rgb {colourvalues} | R Documentation |
Colour Values RGB
Description
Maps colours to values, returning a matrix of RGB(A) values
Usage
colour_values_rgb(
x,
palette = "viridis",
alpha = 255,
na_colour = "#808080FF",
include_alpha = TRUE,
summary = FALSE,
n_summaries = 0,
format = TRUE,
digits = 2
)
color_values_rgb(
x,
palette = "viridis",
alpha = 255,
na_colour = "#808080FF",
include_alpha = TRUE,
summary = FALSE,
n_summaries = 0,
format = TRUE,
digits = 2
)
## S3 method for class 'character'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
## S3 method for class 'logical'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
## S3 method for class 'factor'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
## S3 method for class 'Date'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
## S3 method for class 'POSIXct'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
## S3 method for class 'POSIXlt'
colour_values_to_rgb(
x,
palette,
alpha,
na_colour,
include_alpha,
summary,
n_summaries,
format,
digits
)
Arguments
x |
vector of values to map to a colour |
palette |
colour palette. See details and examples |
alpha |
optional. Single value in [0,255] applied to all colours,
or a decimal in [0, 1) (to indicate a percentage, noting 1 is excluded),
or a vector of numeric values the same length as |
na_colour |
hex string colour to use for NA values in the form |
include_alpha |
logical indicating if the returned hex or matrix should include
the alpha values. Defaults to |
summary |
logical indicating if a summary of the colours should be returned as
well as the full colour mapping. This will be the unique elements of |
n_summaries |
positive integer. If supplied a summary colour palette will be returned
in a list, containing |
format |
logical indicating if the summary values should be formatted. |
digits |
number of decimal places to show in the summary |
Details
The palette can either be
String - use
colour_palettes()
to view available palettesMatrix - At least 5 rows, and 3 (or 4) columns representing the red, green and blue (and alpha) values
The matrix palette
requires 5 rows because the colours are interpolated using a
cubic b-spline. This method requires 5 values.
See Also
colour_values
Examples
colour_values_rgb(1:5)
colour_values_rgb(1:5, include_alpha = FALSE)
colour_values_rgb(-25:25, n_summaries = 5)