Skip to contents

A ggplot2 discrete fill scale that applies the official MapBiomas Fuego Peru (Collection 1) color palette for a given sub-product to a classified SpatRaster (as a factor), for use with tidyterra::geom_spatraster().

Usage

scale_fill_mapbiomas_peru_fire_d(
  product,
  ...,
  lang = c("en", "es"),
  na.translate = FALSE
)

Arguments

product

Character. One of the products listed in get_mapbiomas_peru_fire_products.

...

Additional arguments passed to scale_fill_manual.

lang

Character. Legend language, either "en" (default) or "es".

na.translate

Logical. Should NA values be displayed in the legend? Default FALSE.

Value

A ggplot2 discrete scale object.

Examples

if (FALSE) { # \dontrun{
library(geoidep)
library(ggplot2)
library(tidyterra)
lima <- get_departaments("LIMA", show_progress = FALSE)
freq <- get_mapbiomas_peru_fire(product = "frequency_burned", year = 2024, crop_to = lima)
ggplot() +
  geom_spatraster(data = as.factor(freq)) +
  scale_fill_mapbiomas_peru_fire_d("frequency_burned", lang = "es") +
  theme_minimal()
} # }