palette_color_picker {khroma} | R Documentation |
Color Mapping
Description
Maps values to colors.
Usage
palette_color_picker(
scheme,
domain = NULL,
midpoint = NULL,
ordered = FALSE,
missing = NULL,
...
)
palette_colour_picker(
scheme,
domain = NULL,
midpoint = NULL,
ordered = FALSE,
missing = NULL,
...
)
Arguments
scheme |
A |
domain |
A |
midpoint |
A length-one |
ordered |
A |
missing |
The color to return for |
... |
Further parameters to be passed to |
Details
A wrapper around palette_color_continuous()
and
palette_color_discrete()
.
Value
A palette function
that when called with a single argument returns
a character
vector of colors.
See Also
Other palettes:
palette_color_continuous()
,
palette_color_discrete()
,
palette_shape()
,
palette_size_range()
Examples
## Visualize a simple DEM model
## Distribution of elevation values
elevation <- hist(volcano)
## Where are breaks?
elevation$breaks
## Build palette functions
ramp_BuRd <- palette_color_picker("BuRd")
(col <- ramp_BuRd(elevation$breaks))
image(volcano, col = col)
legend("topright", legend = elevation$breaks, fill = col)
## Rescale to midpoint
ramp_BuRd <- palette_color_picker("BuRd", midpoint = 160)
(col <- ramp_BuRd(elevation$breaks))
image(volcano, col = col)
legend("topright", legend = elevation$breaks, fill = col)
[Package khroma version 1.13.0 Index]