plot_SSB_Rec()
View source ↗On this page
Plot spawning stock biomass (SSB) against the recruitment it produced, from a fitted model.
Usage
plot_SSB_Rec(
model_result,
age_at_recruitment = NULL,
point_size = NULL,
point_color = NULL,
point_shape = 16,
return_data = FALSE,
title = NULL,
xlab = NULL,
ylab = NULL,
font_family = NULL,
title_size = NULL,
axis_title_size = NULL,
axis_text_size = NULL,
strip_text_size = NULL,
legend_text_size = NULL,
x_breaks = NULL,
base_theme = NULL,
title_hjust = NULL
)
Arguments
| Argument | Default | Description |
|---|---|---|
model_result | required | A fit from |
age_at_recruitment | NULL | Numeric or NULL. Recruitment age in years, used to pair SSB with later recruitment. NULL (default) uses the youngest fitted age |
point_size | NULL | Numeric or NULL. Size of the points. NULL inherits the global point_size setting (default 2.5). |
point_color | NULL | Character or NULL. Color of the points. NULL inherits the global point_color setting. |
point_shape | 16 | Numeric. Shape of the points, as in |
return_data | FALSE | Logical. TRUE returns a list with the plot and the paired values (see Value). Default FALSE. |
title | NULL | NULL (default) draws the default title, FALSE, NA or "" draws no title, and a character string draws that string; see |
xlab | NULL | Character or NULL. Label of the x axis. NULL uses the global theme setting. |
ylab | NULL | Character or NULL. Label of the y axis. NULL uses the global theme setting. |
font_family | NULL | Character or NULL. Font family of the text, which must be installed on the computer. NULL uses the global theme setting (default "sans"). |
title_size | NULL | Numeric or NULL. Size of the plot title in pt. NULL uses the global theme setting (default 14). |
axis_title_size | NULL | Numeric or NULL. Size of the axis titles in pt. NULL uses the global theme setting (default 12). |
axis_text_size | NULL | Numeric or NULL. Size of the axis tick labels in pt. NULL uses the global theme setting (default 10). |
strip_text_size | NULL | Numeric or NULL. Size of the panel labels in pt. NULL uses the global theme setting (default 10). |
legend_text_size | NULL | Numeric or NULL. Size of the legend text in pt. NULL uses the global theme setting (default 10). |
x_breaks | NULL | Numeric vector or NULL. Positions of the x-axis breaks. NULL inherits the global x_breaks setting when at least one of its values lies on this axis; otherwise the breaks are chosen automatically. |
base_theme | NULL | Character or NULL. Name of the base ggplot2 theme, such as "bw", "minimal" or "theme_bw". NULL uses the global theme setting. Letter case does not matter. |
title_hjust | NULL | Numeric or NULL. Horizontal position of the title, 0 for left, 0.5 for centered and 1 for right. NULL uses the global theme setting. |
Value
A ggplot object, or with return_data = TRUE a list with plot and data, the paired values of SSB and recruitment (columns SSB and Rec).
Details
The points are fitted quantities; the plot fits no stock-recruitment relationship.
Recruitment in a time step is the number of fish at the youngest fitted age, so each SSB value is paired with the recruitment age_at_recruitment years later. The default NULL uses the youngest fitted age; if that age is not a whole number of time steps, the nearest whole number of steps is used and a message says so. A supplied value is divided by the growth_step of the fit and must give a whole number of time steps on a regular time grid. With quarterly data, 0.25 means a lag of one time step and 1 a lag of four. A lag of zero is allowed; negative, nonfinite and fractional lags are errors. A fit without growth_step uses the spacing of its time steps, and one year when it has no time metadata.
Examples
Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.
Example setup
library(ALSCL)
library(ggplot2)
library(patchwork)
data("YTF_example")
x <- YTF_example
inputs <- x[c("data.CatL", "data.wgt", "data.mat")]
dat <- x$data.CatL
a <- run_acl(x, silent = TRUE)
b <- run_alscl(x, silent = TRUE)
# Use objects defined above
plot_SSB_Rec(b, age_at_recruitment = 1)

plot_SSB_Rec(b, age_at_recruitment = 1)