hypsometric_tints_db {tidyterra}R Documentation

Hypsometric palettes database

Description

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().

Format

A tibble of 1102 rows and 6 columns. with the following fields:

pal

Name of the palette.

limit

Recommended elevation limit (in meters) for each color.

r

Value of the red channel (RGB color mode).

g

Value of the green channel (RGB color mode).

b

Value of the blue channel (RGB color mode).

hex

Hex code of the color.

Source

cpt-city: http://soliton.vm.bytemark.co.uk/pub/cpt-city/.

See Also

scale_fill_hypso_c()

Other datasets: cross_blended_hypsometric_tints_db, grass_db, princess_db, volcano2

Examples


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)
  )


[Package tidyterra version 0.6.1 Index]