riatelab/mapsf

A plan for mf_raster()

Closed this issue · 1 comments

Until v0.8.0 mf_raster() didn't do much, it only displayed a raster, either one band or 3 bands RGB.
v0.8.0 has introduced an automatic continuous legend for one band rasters.

This change was a bit too early. The next release (v0.9.0) will revert these changes and let users access terra::plot() or terra::plotRGB() arguments through mf_raster(). I plan to release this soon so users can rely on the function quickly.

The final plan is to allow categorical, continuous and classified raster maps with "classical" mapsf arguments.

Please keep in mind that the package is called mapsf and not mapterra, but I'll try to make it easier to map a mix of raster and vectorial datasets.

from "mf_raster" branch

v0.9.0 will more likely has features like these:

library(terra)
#> terra 1.7.65
library(mapsf)
r <- rast(system.file("ex/elev.tif", package = "terra"))
r2 <- classify(r, c(140,450,500, 550))
levels(r2) <- data.frame(ID = 0:2, elevation = c("low", "high", "super high"))

# continuous
mf_raster(r)

# interval
mf_raster(r, type = "interval", nbreaks = 5, breaks = "equal", pal = "Burg")

# classes
mf_raster(r2)

Created on 2024-01-12 with reprex v2.1.0