Skip to content

Update DESCRIPTION, NAMESPACE, plotting.R, and docs #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ URL:
https://landr.predictiveecology.org,
https://github.com/PredictiveEcology/LandR
Date: 2025-07-28
Version: 1.1.5.9054
Version: 1.1.5.9055
Authors@R: c(
person("Eliot J B", "McIntire", email = "eliot.mcintire@nrcan-rncan.gc.ca",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")),
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export(plotLeadingSpecies)
export(plotSpatial)
export(plotVTM)
export(plotVegTransitions)
export(plot_genericMap)
export(prepEcoregions)
export(prepEcozonesRst)
export(prepInputsCanDEM)
Expand Down Expand Up @@ -227,6 +228,7 @@ importFrom(ggplot2,stat)
importFrom(ggplot2,stat_summary)
importFrom(ggplot2,sym)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_bw)
importFrom(ggplot2,theme_classic)
importFrom(ggplot2,unit)
importFrom(ggpubr,theme_pubr)
Expand Down Expand Up @@ -363,3 +365,4 @@ importFrom(utils,install.packages)
importFrom(utils,str)
importFrom(utils,tail)
importFrom(utils,untar)
importFrom(viridis,scale_fill_viridis)
28 changes: 28 additions & 0 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,31 @@ plotFunction <- function(ras, studyArea, limits = NULL) {
title = sub("\\.|_", " ", names(ras))
)
}

#' Plot function for generic SpatRaster objects with Plots
#'
#' @param x SpatRaster for current or cumulative harvest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is intended to be generic, then do not specify the type of raster

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ referring to "current or cumulative harvest"

#' @param title character, the plot title
#' @param subtitle character, the plot subtitle
#'
#' @returns ggplot object
#' @export
#' @importFrom ggplot2 ggplot ggtitle theme_bw labs
#' @importFrom tidyterra geom_spatraster
#' @importFrom viridis scale_fill_viridis
plot_genericMap <- function(x, title = NULL, subtitle = NULL) {
if (!inherits(x, "SpatRaster")) {
stop("x must be a SpatRaster object.")
}

gg_gm <- ggplot() +
geom_spatraster(data = x) +
scale_fill_viridis(na.value = "transparent") +
theme_bw()

if (!is.null(title) || !is.null(subtitle)) {
gg_gm <- gg_gm + ggtitle(title) + labs(subtitle = subtitle)
}

gg_gm # return ggplot object
}
21 changes: 21 additions & 0 deletions man/plot_genericMap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/speciesPresent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading