Plot spawning biomass with a reference line as a dashed line. The figure can also be made relative to this reference line rather than in absolute units.
plot_spawning_biomass(
dat,
geom = "line",
group = NULL,
facet = NULL,
ref_line = "msy",
unit_label = "mt",
era = NULL,
lbs = FALSE,
module = NULL,
scale_amount = 1,
relative = FALSE,
make_rda = FALSE,
figures_dir = getwd(),
interactive = TRUE,
...
)Data frame or list. A tibble or named list of tibbles (input as list())
returned from convert_output.
If inputting a list of tibbles, the first tibble's reference point defined
in ref_line is used to plot a reference line or calculate relative spawning biomass.
String. Geom used for the plot.
Default: "line".
Options: "line", "point", or "area"
String. Single column that groups the data.
Set group = "none" to summarize data over all indexing values.
Default: NULL Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL
Character vector. Column name or names used for faceting.
Default: NULL
String or named vector. Reference point name (and value if custom). When multiple models are being compared, a reference line for each model will appear, if desired. The following options can be used to customize the reference line:
all lines are comparing same ref_line = "msy", ref_line = "target", ref_line = "unfished", etc
custom input vector - ref_line = c("sable23_msy"=30, "sable25_msy"=40) – user must indicate which model in label otherwise it will assign in order of dat
input vector of labels - ref_line = c("msy", "target")
Default: "msy"
Options: (including, but not limited to) "target", "msy", and "unfished" If the reference point is not found in the data, set ref_line = c("name" = value).
String. Spawning biomass unit.
Default: "mt"
String. Era of data.
Default: "time"
Options: "early", "time", "fore" (forecast), or NULL (all data)
Logical. TRUE/FALSE; indicate whether to convert the y-axis values from kilograms to pounds. The default units match the default in the unit_label argument - 'mt'.
Default: FALSE
Character vector. (Optional) Module name found in dat$module_name.
If selecting >1 module, place them in a vector like c("module1", "module2").
Default: NULL
If the interactive and >1 module_name is found, user will select the
module_name in the console. @seealso filter_data()
Number. A number to scale the y-axis values.
Default: 1
Logical. TRUE/FALSE; specify whether to set y-axis values relative to the ref_line value.
Default: FALSE
Logical. TRUE/FALSE; indicate whether to save the object and
make an automated caption and alternative text in the form of an rda object. If TRUE,
the rda will be exported to the folder indicated in the argument "figures_dir".
Default: FALSE.
Path. Path to the "figures" folder.
Default: getwd()
The folder is created within the path if it does not exist.
Logical. TRUE/FALSE; indicate whether the environment is interactive.
Default: FALSE
Arguments called from geom_line or geom_point
A plot showing spawning biomass over time.
The input is from an assessment model output file
translated to a standardized output (convert_output).
There are options to return a ggplot2 object or export an .rda object
containing associated caption and alternative text for the figure.
All plotting functions automatically recognize indexing variables and will
use them in groupings and/or facetting. @seealso process_data().
plot_spawning_biomass(
dat = stockplotr:::example_data,
geom = "line",
ref_line = "msy",
unit_label = "mt",
scale_amount = 1000,
interactive = FALSE,
module = "TIME_SERIES",
linewidth = 1.5
)
#> Ignoring unknown labels:
#> • linetype : "Growth_pattern"
#> • shape : "Growth_pattern"
plot_spawning_biomass(
dat = stockplotr:::example_data,
ref_line = c("target" = 10),
interactive = FALSE,
module = "TIME_SERIES"
)
#> Ignoring unknown labels:
#> • linetype : "Growth_pattern"
#> • shape : "Growth_pattern"
if (FALSE) { # \dontrun{
plot_spawning_biomass(
dat = list("2023" = model1, "2025" = model2),
ref_line = c("SBF30" = 1500, "SBF40" = 2300)
)
} # }