ramp {khroma} | R Documentation |
Color Ramp
Description
Provides a color scheme that map a numeric
vector to colors.
Usage
ramp(palette, ...)
Arguments
palette |
A |
... |
Further arguments to be passed to |
Value
A palette function
with argument a vector of values that are mapped to
colors. The data midpoint can be specified with an additional midpoint
argument (see examples).
Author(s)
N. Frerebeau
See Also
Other color palettes:
colour()
,
info()
,
scale_picker
Examples
## Visualize a simple DEM model
## Distribution of elevation values
elevation <- hist(volcano)
## Where are breaks?
elevation$breaks
## Build palette function
ramp_BuRd <- ramp(palette = "BuRd")
(col <- ramp_BuRd(elevation$breaks))
image(volcano, col = col)
legend("topright", legend = attr(col, "breaks"), fill = col)
## Rescale to midpoint
(col <- ramp_BuRd(elevation$breaks, midpoint = 160))
image(volcano, col = col)
legend("topright", legend = attr(col, "breaks"), fill = col)
[Package khroma version 1.12.0 Index]