diff --git a/NAMESPACE b/NAMESPACE index 7e3adaa..5b6295a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -62,6 +62,7 @@ importFrom(dplyr,pull) importFrom(dplyr,rename) importFrom(dplyr,rename_at) importFrom(dplyr,rename_with) +importFrom(dplyr,row_number) importFrom(dplyr,rowwise) importFrom(dplyr,select) importFrom(dplyr,starts_with) @@ -143,7 +144,6 @@ importFrom(sf,st_crs) importFrom(sf,st_distance) importFrom(sf,st_drop_geometry) importFrom(sf,st_geometry) -importFrom(sf,st_join) importFrom(sf,st_nearest_feature) importFrom(sf,st_polygon) importFrom(sf,st_set_crs) diff --git a/R/splnr_plotting.R b/R/splnr_plotting.R index 82066b8..5328d66 100644 --- a/R/splnr_plotting.R +++ b/R/splnr_plotting.R @@ -643,7 +643,7 @@ splnr_plot_costOverlay <- function(soln, gg <- ggplot2::ggplot() + ggplot2::theme_bw(base_size = base_size) + # Plot the selected solution units in black. - ggplot2::geom_sf(data = soln, fill = "black", colour = "black", size = 0.0001) + + ggplot2::geom_sf(data = soln, fill = "grey30", colour = "grey30", size = 0.0001) + # Overlay the cost data on top of the selected units with transparency. ggplot2::geom_sf(data = Cost, ggplot2::aes(fill = !!rlang::sym(costName)), alpha = 0.1, colour = NA, size = 0.0001) + # Apply a gradient fill for the cost, with specified low and high colors. @@ -658,8 +658,8 @@ splnr_plot_costOverlay <- function(soln, ), oob = scales::squish, # Squish values outside the limits. guide = ggplot2::guide_colourbar( - barwidth = ggplot2::unit(20, "lines"), # Twice the width of the climate colourbar (10 lines). - barheight = ggplot2::unit(6, "lines") # Twice the height of the climate colourbar (3 lines). + barwidth = ggplot2::unit(3, "lines"), + barheight = ggplot2::unit(10, "lines") ) ) + # Set coordinate limits based on the bounding box of the cost data. diff --git a/man/splnr_arrangeFeatures.Rd b/man/splnr_arrangeFeatures.Rd index 0feb870..317d65a 100644 --- a/man/splnr_arrangeFeatures.Rd +++ b/man/splnr_arrangeFeatures.Rd @@ -30,14 +30,3 @@ Sorting can be beneficial for tasks like debugging, comparing data from different runs, or ensuring deterministic behavior in algorithms that process spatial units sequentially. } -\examples{ -\dontrun{ -print("Original order:") -print(dat_species_prob) - -# Sort the features. -df_arranged <- splnr_arrangeFeatures(df = dat_species_prob) -print("Sorted order:") -print(df_arranged) -} -} diff --git a/man/splnr_climate_featureApproach.Rd b/man/splnr_climate_featureApproach.Rd index 194f9c5..68ae397 100644 --- a/man/splnr_climate_featureApproach.Rd +++ b/man/splnr_climate_featureApproach.Rd @@ -68,7 +68,7 @@ Feature_result <- splnr_climate_featureApproach( percentile = 35, refugiaTarget = 0.3 ) -out_sf_feature <- Feature_result$Features +out_sf_feature <- Feature_result$Features targets_feature <- Feature_result$Targets } } diff --git a/man/splnr_climate_percentileApproach.Rd b/man/splnr_climate_percentileApproach.Rd index bb569b8..3c1dee9 100644 --- a/man/splnr_climate_percentileApproach.Rd +++ b/man/splnr_climate_percentileApproach.Rd @@ -64,7 +64,7 @@ Percentile_result <- splnr_climate_percentileApproach( direction = 1, percentile = 35 ) -out_sf_percentile <- Percentile_result$Features +out_sf_percentile <- Percentile_result$Features targets_percentile <- Percentile_result$Targets } } diff --git a/man/splnr_climate_priorityAreaApproach.Rd b/man/splnr_climate_priorityAreaApproach.Rd index 21c14c0..f042a3f 100644 --- a/man/splnr_climate_priorityAreaApproach.Rd +++ b/man/splnr_climate_priorityAreaApproach.Rd @@ -68,7 +68,7 @@ CPA_result <- splnr_climate_priorityAreaApproach( percentile = 5, refugiaTarget = 1 ) -out_sf_cpa <- CPA_result$Features -targets_cpa <- CPA_result$Targets +out_sf_cpa <- CPA_result$Features +targets_cpa <- CPA_result$Targets } } diff --git a/man/splnr_get_IUCNRedList.Rd b/man/splnr_get_IUCNRedList.Rd index 744f0bd..66fc8ae 100644 --- a/man/splnr_get_IUCNRedList.Rd +++ b/man/splnr_get_IUCNRedList.Rd @@ -58,9 +58,11 @@ present in the IUCN Red List database. # For example: Sys.setenv(IUCN_REDLIST_KEY = "YOUR_API_KEY_HERE") # Example: Create a dataframe with species names and retrieve their IUCN Red List categories. -df_species_redlist <- data.frame(Species = c("Diomedea exulans", - "Hippocampus kuda", - "Squatina squatina")) \%>\% +df_species_redlist <- data.frame(Species = c( + "Diomedea exulans", + "Hippocampus kuda", + "Squatina squatina" +)) \%>\% splnr_get_IUCNRedList() print(df_species_redlist) diff --git a/man/splnr_get_distCoast.Rd b/man/splnr_get_distCoast.Rd index 7cb464e..22f57b2 100644 --- a/man/splnr_get_distCoast.Rd +++ b/man/splnr_get_distCoast.Rd @@ -59,7 +59,7 @@ landmass <- rnaturalearth::ne_countries( ) if (exists("dat_sf") && exists("landmass")) { - # Transform landmass to the same CRS as the planning units + # Transform landmass to the same CRS as the planning units landmass_proj <- sf::st_transform(landmass, sf::st_crs(dat_sf)) dat_sf_custom_coast <- splnr_get_distCoast(dat_sf, custom_coast = landmass_proj) summary(dat_sf_custom_coast$coastDistance_km) diff --git a/man/splnr_get_gfw.Rd b/man/splnr_get_gfw.Rd index c99b60d..f6a5f4d 100644 --- a/man/splnr_get_gfw.Rd +++ b/man/splnr_get_gfw.Rd @@ -81,7 +81,7 @@ inclusive in the data recovery. # Example: Retrieve yearly GFW data for Australia, transformed to a # Mollweide projection (ESRI:54009) and compressed (aggregated) by location. gfw_data <- splnr_get_gfw( - region = 'Australia', + region = "Australia", start_date = "2021-01-01", end_date = "2022-12-31", temp_res = "YEARLY", diff --git a/man/splnr_gg_add.Rd b/man/splnr_gg_add.Rd index 781b23c..3092260 100644 --- a/man/splnr_gg_add.Rd +++ b/man/splnr_gg_add.Rd @@ -32,6 +32,7 @@ splnr_gg_add( colorLockOut = "black", legendLockOut = "", labelLockOut = "", + base_size = 14, ggtheme = "Default" ) } @@ -130,6 +131,10 @@ labels (e.g. \code{c(Shipping_Lane = "Shipping Lane")}). When a single string is supplied it is used as the label for all areas. Defaults to \code{""}.} +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()} when \code{ggtheme = "Default"}. All text elements scale +proportionally from this value. Defaults to \code{14}.} + \item{ggtheme}{The \code{ggplot2} theme to apply. Can be: \itemize{ \item \code{NA} or \code{FALSE}: No theme is applied, using \code{ggplot2} defaults. diff --git a/man/splnr_plot.Rd b/man/splnr_plot.Rd index 5d7f045..d04d395 100644 --- a/man/splnr_plot.Rd +++ b/man/splnr_plot.Rd @@ -11,7 +11,8 @@ splnr_plot( colourVals = c("#c6dbef", "#3182bd"), plotTitle = "", legendTitle = NULL, - legendLabels = NULL + legendLabels = NULL, + base_size = 14 ) splnr_plot( @@ -21,7 +22,8 @@ splnr_plot( colourVals = c("#c6dbef", "#3182bd"), plotTitle = "", legendTitle = NULL, - legendLabels = NULL + legendLabels = NULL, + base_size = 14 ) } \arguments{ @@ -51,6 +53,10 @@ a default title will be used based on the data type.} \item{legendLabels}{A character vector of strings to use for the legend labels, particularly useful for binary or logical data (e.g., \code{c("Absent", "Present")}). If \code{NULL}, default labels are used for binary/logical plots.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the spatial plot. diff --git a/man/splnr_plot_circBplot.Rd b/man/splnr_plot_circBplot.Rd index 5d2c7b5..e5796ab 100644 --- a/man/splnr_plot_circBplot.Rd +++ b/man/splnr_plot_circBplot.Rd @@ -11,7 +11,8 @@ splnr_plot_circBplot( indicateTargets = TRUE, impTarget = NA, repTarget = NA, - colTarget = "red" + colTarget = "red", + base_size = 14 ) } \arguments{ @@ -41,6 +42,10 @@ percentage for 'representative' features. Required if \code{indicateTargets} is \item{colTarget}{A \link[base:character]{character} string specifying the color for the target indicator lines.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_minimal()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \link[ggplot2:ggplot]{ggplot2::ggplot} object of the circular bar plot. diff --git a/man/splnr_plot_climData.Rd b/man/splnr_plot_climData.Rd index d750e15..5624daa 100644 --- a/man/splnr_plot_climData.Rd +++ b/man/splnr_plot_climData.Rd @@ -9,7 +9,8 @@ splnr_plot_climData( colInterest, colorMap = "C", plotTitle = " ", - legendTitle = "Climate metric" + legendTitle = "Climate metric", + base_size = 14 ) } \arguments{ @@ -29,6 +30,10 @@ Defaults to \code{" "} (a single space, effectively no subtitle).} \item{legendTitle}{A character string for the title of the legend. Defaults to \code{"Climate metric"}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the spatial plot of the climate metric. diff --git a/man/splnr_plot_climKernelDensity.Rd b/man/splnr_plot_climKernelDensity.Rd index 32bd243..a868f03 100644 --- a/man/splnr_plot_climKernelDensity.Rd +++ b/man/splnr_plot_climKernelDensity.Rd @@ -6,25 +6,29 @@ \usage{ splnr_plot_climKernelDensity( soln, - solution_names = "solution_1", - climate_names = "metric", + solution_name = "solution_1", + climate_name = "metric", type = "Normal", colorMap = "C", legendTitle = expression(" °C y"^"-1" * ""), - xAxisLab = expression("Climate warming ( °C y"^"-1" * ")") + xAxisLab = expression("Climate warming ( °C y"^"-1" * ")"), + base_size = 14 ) } \arguments{ -\item{soln}{For \code{type = "Normal"}: A \code{list} of \code{prioritizr} solution objects -(e.g., \code{list(s1, s2)}). Each solution must contain a \code{metric} column and -a \code{solution_1} column. -For \code{type = "Basic"}: A single \code{prioritizr} solution \code{sf} object.} +\item{soln}{A single \code{prioritizr} solution object (\code{sf} or \code{data.frame}). +For \code{type = "Normal"}: must contain the columns named by \code{solution_name} +and \code{climate_name}. +For \code{type = "Basic"}: must be an \code{sf} object with \code{solution_1} and +\code{metric} columns.} -\item{solution_names}{A character vector of names corresponding to each solution in -\code{soln} when \code{type = "Normal"}. Not used for \code{type = "Basic"}. -Defaults to \code{NA}.} +\item{solution_name}{A scalar character string naming the solution column +(0/1 or logical) in \code{soln}. Used only for \code{type = "Normal"}. +Defaults to \code{"solution_1"}.} -\item{climate_names}{A character string of the name of the climate} +\item{climate_name}{A scalar character string naming the climate metric +column (numeric) in \code{soln}. Used only for \code{type = "Normal"}. +Defaults to \code{"metric"}.} \item{type}{A character string specifying the plotting style. Must be either \code{"Normal"} or \code{"Basic"}. Defaults to \code{"Normal"}.} @@ -34,36 +38,39 @@ Defaults to \code{NA}.} \url{https://ggplot2.tidyverse.org/reference/scale_viridis.html} for all options. Defaults to \code{"C"}.} -\item{legendTitle}{A character string or \code{expression} for the title of the legend. -Defaults to \code{expression(" \\u00B0C y"^"-1" * "")}, representing "°C year⁻¹".} +\item{legendTitle}{A character string or \code{expression} for the title of the +viridis colour bar legend. Defaults to +\code{expression(" \\u00B0C y"^"-1" * "")}, representing "°C year⁻¹".} -\item{xAxisLab}{A character string or \code{expression} for the x-axis label, -depending on the climate metric input. Defaults to -\code{expression("Climate warming ( \\u00B0C y"^"-1" * ")")}.} +\item{xAxisLab}{A character string or \code{expression} for the x-axis label. +Defaults to \code{expression("Climate warming ( \\u00B0C y"^"-1" * ")")}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the kernel density plot. } \description{ -\code{splnr_plot_climKernelDensity()} generates kernel density plots for -climate-smart spatial plans, offering two distinct plotting styles: -"Normal" (for publication-quality comparison of multiple solutions) and -"Basic" (for simplified visualization for stakeholders). +\code{splnr_plot_climKernelDensity()} generates kernel density plots for a single +climate-smart spatial plan, offering two distinct plotting styles: +"Normal" (for publication-quality visualisation) and "Basic" (for simplified +visualisation for stakeholders). } \details{ -This wrapper function intelligently dispatches to either +This wrapper function dispatches to either \code{splnr_plot_climKernelDensity_Fancy()} (for \code{type = "Normal"}) or \code{splnr_plot_climKernelDensity_Basic()} (for \code{type = "Basic"}) based on the \code{type} parameter. -The "Normal" (Fancy) style is suitable for detailed comparisons, -accommodating a list of solutions and custom axis labels, while the "Basic" -style is streamlined for clarity and quick interpretation, ideal for -stakeholder engagement. +The "Normal" style produces a ridge plot with a viridis gradient fill for +selected planning units, a grey dotted ridge for unselected units, vertical +median lines, and a categorical legend. The "Basic" style is streamlined for +clarity and quick interpretation. -Both underlying functions require a \code{prioritizr} solution containing a -climate metric column with climate metric information and a prioritizr solution column -indicating selected planning units. +To compare two solutions side-by-side, call this function once per solution +and combine the results with \code{patchwork::wrap_plots()}. } \examples{ \dontrun{ @@ -86,10 +93,15 @@ CPA <- splnr_climate_priorityAreaApproach( refugiaTarget = 1 ) -# Join climate metric to features for the problem out_sf <- CPA$Features \%>\% - dplyr::mutate(Cost_None = rep(1, dim(.)[[1]])) \%>\% # Ensure enough costs for PUs - sf::st_join(dat_clim, join = sf::st_equals) + dplyr::mutate(Cost_None = 1, .row_id = dplyr::row_number()) \%>\% + dplyr::left_join( + dat_clim \%>\% + sf::st_drop_geometry() \%>\% + dplyr::mutate(.row_id = dplyr::row_number()), + by = ".row_id" + ) \%>\% + dplyr::select(-".row_id") # Define features for the prioritizr problem usedFeatures <- out_sf \%>\% @@ -110,28 +122,38 @@ dat_solnClim <- prioritizr::solve.ConservationProblem(p1) plot_basic_kde <- splnr_plot_climKernelDensity(soln = dat_solnClim, type = "Basic") print(plot_basic_kde) -# Example 2: Normal (Fancy) kernel density plot for a single solution -plot_normal_kde_single <- splnr_plot_climKernelDensity( - soln = list(dat_solnClim), - solution_names = c("Solution 1"), +# Example 2: Normal (Fancy) kernel density plot +plot_normal_kde <- splnr_plot_climKernelDensity( + soln = dat_solnClim, type = "Normal" ) -print(plot_normal_kde_single) +print(plot_normal_kde) -# Example 3: Normal (Fancy) plot comparing two solutions (create a dummy second solution) -# For demonstration, let's create another dummy solution +# Example 3: Compare two solutions side-by-side using patchwork dat_solnClim_2 <- dat_solnClim \%>\% - dplyr::mutate(solution_1 = sample(c(0, 1), n(), replace = TRUE)) # Randomize selection + dplyr::mutate(solution_1 = sample(c(0L, 1L), dplyr::n(), replace = TRUE)) + +plot_compare <- patchwork::wrap_plots( + splnr_plot_climKernelDensity( + soln = dat_solnClim, type = "Normal", + legendTitle = "Scenario 1", xAxisLab = "Climate metric" + ), + splnr_plot_climKernelDensity( + soln = dat_solnClim_2, type = "Normal", + legendTitle = "Scenario 2", xAxisLab = "Climate metric" + ), + ncol = 1 +) +print(plot_compare) -plot_normal_kde_multi <- splnr_plot_climKernelDensity( - soln = list(dat_solnClim, dat_solnClim_2), - solution_names = c("Solution A", "Solution B"), - climate_names = "metric", +# Example 4: Custom colour map and labels +plot_custom <- splnr_plot_climKernelDensity( + soln = dat_solnClim, type = "Normal", colorMap = "plasma", legendTitle = "Climate Value", xAxisLab = "Climate Metric (units)" ) -print(plot_normal_kde_multi) +print(plot_custom) } } diff --git a/man/splnr_plot_comparison.Rd b/man/splnr_plot_comparison.Rd index d66c58c..a37c11a 100644 --- a/man/splnr_plot_comparison.Rd +++ b/man/splnr_plot_comparison.Rd @@ -7,7 +7,8 @@ splnr_plot_comparison( soln1, soln2, - legendTitle = "Scenario 2 compared to Scenario 1:" + legendTitle = "Scenario 2 compared to Scenario 1:", + base_size = 14 ) } \arguments{ @@ -19,6 +20,10 @@ with a \code{solution_1} column. This is the solution being compared against \co \item{legendTitle}{A character string for the title of the legend. Defaults to \code{"Scenario 2 compared to Scenario 1:"}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the spatial comparison of the two solutions. diff --git a/man/splnr_plot_corrMat.Rd b/man/splnr_plot_corrMat.Rd index 110d9b9..deb60bb 100644 --- a/man/splnr_plot_corrMat.Rd +++ b/man/splnr_plot_corrMat.Rd @@ -9,7 +9,8 @@ splnr_plot_corrMat( colourGradient = c("#BB4444", "#FFFFFF", "#4477AA"), legendTitle = "Correlation \\ncoefficient", AxisLabels = NULL, - plotTitle = "" + plotTitle = "", + base_size = 14 ) } \arguments{ @@ -32,6 +33,10 @@ If \code{NULL} (default), the column names of \code{x} will be used. The length this vector must match the number of rows/columns in \code{x}.} \item{plotTitle}{A character string for the title of the plot. Defaults to \code{""}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the correlation matrix plot. diff --git a/man/splnr_plot_costOverlay.Rd b/man/splnr_plot_costOverlay.Rd index 11da0f0..db079b8 100644 --- a/man/splnr_plot_costOverlay.Rd +++ b/man/splnr_plot_costOverlay.Rd @@ -9,7 +9,8 @@ splnr_plot_costOverlay( cost = NA, costName = "Cost", legendTitle = "Cost", - plotTitle = "Solution overlaid with cost" + plotTitle = "Solution overlaid with cost", + base_size = 14 ) } \arguments{ @@ -29,6 +30,10 @@ Defaults to \code{"Cost"}.} \item{plotTitle}{A character string for the subtitle of the plot. Defaults to \code{"Solution overlaid with cost"}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the solution with cost overlay. diff --git a/man/splnr_plot_featureRep.Rd b/man/splnr_plot_featureRep.Rd index 6481a21..787c7b2 100644 --- a/man/splnr_plot_featureRep.Rd +++ b/man/splnr_plot_featureRep.Rd @@ -14,6 +14,7 @@ splnr_plot_featureRep( showTarget = NA, plotTitle = "", sort_by = "category", + base_size = 14, ... ) } @@ -54,6 +55,10 @@ by which to sort the features on the x-axis. Accepted values include: \code{"category"}, \code{"feature"}, \code{"target"}, \code{"representation"} (\code{relative_held}), or \code{"difference"} (between representation and target).} +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} + \item{...}{Other arguments passed on to \code{\link[ggplot2:theme]{ggplot2::theme()}} to customize the plot's theme.} } \value{ diff --git a/man/splnr_plot_importanceScore.Rd b/man/splnr_plot_importanceScore.Rd index 7d09828..69253c9 100644 --- a/man/splnr_plot_importanceScore.Rd +++ b/man/splnr_plot_importanceScore.Rd @@ -11,7 +11,8 @@ splnr_plot_importanceScore( plotTitle = "", colorMap = "A", decimals = 4, - legendTitle = "Importance Score" + legendTitle = "Importance Score", + base_size = 14 ) } \arguments{ @@ -36,6 +37,10 @@ Defaults to \code{4}.} \item{legendTitle}{A character string for the title of the legend. Defaults to \code{"Importance Score"}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the plot of importance scores. diff --git a/man/splnr_plot_selectionFreq.Rd b/man/splnr_plot_selectionFreq.Rd index 66c0521..1857ba5 100644 --- a/man/splnr_plot_selectionFreq.Rd +++ b/man/splnr_plot_selectionFreq.Rd @@ -8,7 +8,8 @@ splnr_plot_selectionFreq( selFreq, plotTitle = "", paletteName = "Greens", - legendTitle = "Selection \\nFrequency" + legendTitle = "Selection \\nFrequency", + base_size = 14 ) } \arguments{ @@ -24,6 +25,10 @@ Defaults to \code{"Greens"}.} \item{legendTitle}{A character string for the title of the legend. Defaults to \code{"Selection \\nFrequency"}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the plot of Planning Unit selection frequency. diff --git a/man/splnr_plot_solution.Rd b/man/splnr_plot_solution.Rd index b544818..3fe6879 100644 --- a/man/splnr_plot_solution.Rd +++ b/man/splnr_plot_solution.Rd @@ -11,7 +11,8 @@ splnr_plot_solution( legendLabels = c("Not selected", "Selected"), plotTitle = "Solution", legendTitle = "Planning Units", - zones = FALSE + zones = FALSE, + base_size = 14 ) } \arguments{ @@ -37,6 +38,10 @@ Defaults to \code{"Planning Units"}.} \item{zones}{A logical value. Set to \code{TRUE} if the \code{prioritizr} solution contains multiple zones (i.e., it's a multi-zone problem). Defaults to \code{FALSE}.} + +\item{base_size}{A numeric value for the base font size (in points) passed to +\code{ggplot2::theme_bw()}. All text elements scale proportionally from this value. +Defaults to \code{14}.} } \value{ A \code{ggplot} object representing the plot of the conservation solution. diff --git a/man/splnr_scale_01.Rd b/man/splnr_scale_01.Rd index 3206582..51111c5 100644 --- a/man/splnr_scale_01.Rd +++ b/man/splnr_scale_01.Rd @@ -36,15 +36,3 @@ already within the desired range. This approach ensures that the data is scaled appropriately without hardcoding a fixed division factor. } -\examples{ -\dontrun{ -# Scale the 'Spp1' column. -df_scaled_spp1 <- splnr_scale_01(dat = dat_species_prob, col_name = "Spp1") -print(df_scaled_spp1) - -# Example where max is already <= 1 -df_already_scaled <- dat_species_prob \%>\% dplyr::mutate(Spp1 = Spp1 / 100) -df_no_change <- splnr_scale_01(dat = df_already_scaled, col_name = "Spp1") -print(df_no_change) # Spp1 values should remain unchanged -} -} diff --git a/man/splnr_targets_byIUCN.Rd b/man/splnr_targets_byIUCN.Rd index 13acb7b..8c53077 100644 --- a/man/splnr_targets_byIUCN.Rd +++ b/man/splnr_targets_byIUCN.Rd @@ -57,8 +57,10 @@ single \code{IUCN_target} is provided) are: "EX" (Extinct), "EW" (Extinct in the # Example 1: Assigning specific targets to categories # Create a dummy dataframe resembling output from splnr_get_IUCNRedList df_species_iucn <- data.frame( - Species = c("Diomedea exulans", "Hippocampus kuda", - "Squatina squatina", "Common Dolphin"), + Species = c( + "Diomedea exulans", "Hippocampus kuda", + "Squatina squatina", "Common Dolphin" + ), IUCN_Category = c("VU", "EN", "CR", "LC") )