ramp | R Documentation |
Provides a color scheme that map a numeric
vector to colors.
ramp(palette, ...)
palette |
A |
... |
Further arguments to be passed to |
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).
N. Frerebeau
Other color palettes:
colour()
,
info()
,
scale_picker
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.