hypsometric_tints_db | R Documentation |
A tibble
including the color map of
33 gradient palettes. All the
palettes includes also a definition of colors limits in terms of elevation
(meters), that can be used with ggplot2::scale_fill_gradientn()
.
A tibble
of 1102 rows and
6 columns. with the following fields:
Name of the palette.
Recommended elevation limit (in meters) for each color.
Value of the red channel (RGB color mode).
Value of the green channel (RGB color mode).
Value of the blue channel (RGB color mode).
Hex code of the color.
cpt-city: http://seaviewsensing.com/pub/cpt-city/.
scale_fill_hypso_c()
Other datasets:
cross_blended_hypsometric_tints_db
,
grass_db
,
princess_db
,
volcano2
data("hypsometric_tints_db")
hypsometric_tints_db
# Select a palette
wikicols <- hypsometric_tints_db %>%
filter(pal == "wiki-2.0")
f <- system.file("extdata/asia.tif", package = "tidyterra")
r <- terra::rast(f)
library(ggplot2)
p <- ggplot() +
geom_spatraster(data = r) +
labs(fill = "elevation")
p +
scale_fill_gradientn(colors = wikicols$hex)
# Use with limits
p +
scale_fill_gradientn(
colors = wikicols$hex,
values = scales::rescale(wikicols$limit),
limit = range(wikicols$limit)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.