This article shows how to plot the SpatRaster produced by rasterpic_img() with several packages.
Base plots
The most straightforward option is to use the base plot() methods provided by the package terra (terra::plotRGB()):
With ggplot2 + tidyterra
tidyterra provides full support for terra SpatRaster objects:
With tmap
tmap can also be used to create great maps:
With mapsf
mapsf also provides this functionality:
With maptiles
maptiles is an interesting package that provides the ability to download map tiles from different providers. It also has a specific function for plotting terra SpatRaster objects:
References
Tennekes M (2018). “tmap: Thematic Maps in R.” Journal of Statistical Software, 84(6), 1–39. doi:10.18637/jss.v084.i06.
Giraud T (2026). mapsf: Thematic Cartography. doi:10.32614/CRAN.package.mapsf.
Hernangómez D (2023). “Using the tidyverse with terra objects: the tidyterra package.” Journal of Open Source Software, 8(91), 5751. ISSN 2475-9066, doi:10.21105/joss.05751, https://doi.org/10.21105/joss.05751.
Hijmans R, Brown A, Barbosa M (2026). terra: Spatial Data Analysis. R package version 1.9-1, https://rspatial.org/.
Wickham H (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org.