Provides a colour scheme that map a numeric
vector to colours.
Value
A palette function with the following attributes, that when called
with a single argument (the number of levels, e.g. the breaks
returned by
hist()
) returns a vector of colours.
See also
Other colour palettes:
colour()
,
info()
,
scale_picker
Examples
## Visualize a simple DEM model
## Distribution of elevation values
elevation <- hist(volcano)
## Where are breaks?
elevation$breaks
#> [1] 90 100 110 120 130 140 150 160 170 180 190 200
## No rescaling
ramp_default <- ramp(elevation$breaks, palette = "BuRd")(10)
image(volcano, col = ramp_default)
legend("topright", legend = attr(ramp_default, "breaks"), fill = ramp_default)
## Rescale to midpoint
ramp_160 <- ramp(elevation$breaks, palette = "BuRd", midpoint = 160)(10)
image(volcano, col = ramp_160)
legend("topright", legend = attr(ramp_160, "breaks"), fill = ramp_160)