library(terra)
# Geological Eras
# Spanish Geological Survey (IGME)
r <- rast(system.file("extdata/cyl_era.tif", package = "tidyterra"))
plot(r)
# Get coltab
coltab_pal <- get_coltab_pal(r)
coltab_pal
# \donttest{
# With ggplot2 + tidyterra
library(ggplot2)
gg <- ggplot() +
geom_spatraster(data = r)
# Default plot
gg
# With coltabs
gg +
scale_fill_coltab(data = r)
# }
Run the code above in your browser using DataLab