Map a Single Raster Layer
Arguments
- x
a
SpatRaster
object (packageterra
). A raster of one single layer- ...
other parameters passed to
theme()
Examples
library(ggplot2)
## Load raster ----
tavg <- system.file("extdata", "annual_mean_temp.tif", package = "funbiogeo")
tavg <- terra::rast(tavg)
## Default map ----
fb_map_raster(tavg)
## Map with custom theme ----
fb_map_raster(tavg, legend.position = "bottom")
## Advanced customization ----
my_map <- fb_map_raster(tavg) +
scale_fill_distiller("Temperature", palette = "Spectral") +
theme(legend.position = "bottom") +
ggtitle("Mean annual temperature in Western Europe")
my_map
## Map w/o annotation ----
fb_map_raster(tavg) +
theme_void() +
theme(legend.position = "none")