Skip to content

Commit 2c97097

Browse files
committed
Update DESCRIPTION, NAMESPACE, plotting.R, and docs
1 parent c711346 commit 2c97097

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ URL:
99
https://landr.predictiveecology.org,
1010
https://github.com/PredictiveEcology/LandR
1111
Date: 2025-07-28
12-
Version: 1.1.5.9054
12+
Version: 1.1.5.9055
1313
Authors@R: c(
1414
person("Eliot J B", "McIntire", email = "eliot.mcintire@nrcan-rncan.gc.ca",
1515
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")),

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export(plotLeadingSpecies)
109109
export(plotSpatial)
110110
export(plotVTM)
111111
export(plotVegTransitions)
112+
export(plot_genericMap)
112113
export(prepEcoregions)
113114
export(prepEcozonesRst)
114115
export(prepInputsCanDEM)
@@ -227,6 +228,7 @@ importFrom(ggplot2,stat)
227228
importFrom(ggplot2,stat_summary)
228229
importFrom(ggplot2,sym)
229230
importFrom(ggplot2,theme)
231+
importFrom(ggplot2,theme_bw)
230232
importFrom(ggplot2,theme_classic)
231233
importFrom(ggplot2,unit)
232234
importFrom(ggpubr,theme_pubr)
@@ -363,3 +365,4 @@ importFrom(utils,install.packages)
363365
importFrom(utils,str)
364366
importFrom(utils,tail)
365367
importFrom(utils,untar)
368+
importFrom(viridis,scale_fill_viridis)

R/plotting.R

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,31 @@ plotFunction <- function(ras, studyArea, limits = NULL) {
285285
title = sub("\\.|_", " ", names(ras))
286286
)
287287
}
288+
289+
#' Plot function for generic SpatRaster objects with Plots
290+
#'
291+
#' @param x SpatRaster for current or cumulative harvest
292+
#' @param title character, the plot title
293+
#' @param subtitle character, the plot subtitle
294+
#'
295+
#' @returns ggplot object
296+
#' @export
297+
#' @importFrom ggplot2 ggplot ggtitle theme_bw labs
298+
#' @importFrom tidyterra geom_spatraster
299+
#' @importFrom viridis scale_fill_viridis
300+
plot_genericMap <- function(x, title = NULL, subtitle = NULL) {
301+
if (!inherits(x, "SpatRaster")) {
302+
stop("x must be a SpatRaster object.")
303+
}
304+
305+
gg_gm <- ggplot() +
306+
geom_spatraster(data = x) +
307+
scale_fill_viridis(na.value = "transparent") +
308+
theme_bw()
309+
310+
if (!is.null(title) || !is.null(subtitle)) {
311+
gg_gm <- gg_gm + ggtitle(title) + labs(subtitle = subtitle)
312+
}
313+
314+
gg_gm # return ggplot object
315+
}

man/plot_genericMap.Rd

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/speciesPresent.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)