plot_compare_F()
View source ↗On this page
Draw the fishing mortality of two fits as heat maps by time step and age (ACL) or length (ALSCL), side by side.
Usage
plot_compare_F(
model1,
model2,
model1_name = NULL,
model2_name = NULL,
palette = NULL,
title = NULL
)
Arguments
| Argument | Default | Description |
|---|---|---|
model1 | required | The first fit. |
model2 | required | The second fit. |
model1_name | NULL | Character or NULL. Name of the first fit in the plot and in the default title. NULL takes the model type ("ACL" or "ALSCL"); when both fits have the same type, the F structure, or 1 and 2, is added in parentheses. |
model2_name | NULL | Character or NULL. Name of the second fit in the plot and in the default title. NULL takes the model type ("ACL" or "ALSCL"); when both fits have the same type, the F structure, or 1 and 2, is added in parentheses. |
palette | NULL | Character or NULL. Fill colors of the heat maps. NULL uses the global low_col and high_col settings (white to dark blue under the default style). A palette name ("default", "npg", "aaas", "nejm", "lancet" or "jama") gives a gradient to the primary color of that palette, and any other name is taken as a viridis option, such as "magma". Letter case does not matter. |
title | NULL | NULL (default) draws the default title, FALSE, NA or "" draws no title, and a character string draws that string; see |
Value
A ggplot object, which can be styled further or saved with acl_save_plot().
Details
ACL estimates F by age and ALSCL by length; a comparison should state whether the rows are ages or lengths, and the unit of the time step.
Two fits of the same model get distinct default names, such as ACL (group_year) and ACL (year); model1_name and model2_name set other names, which must differ. Each fit keeps its own time steps, so the two fits can cover different years. A visual comparison does not show that the likelihoods or the biological assumptions of the two fits are comparable.
The ACL rows show fitted ages, including fractional ages for quarterly data. The oldest age class is a plus group and is marked with a plus sign, for example "Age 15+". For a fit without age coordinates, the rows are labelled with numbered age bins, such as "Age bin 1". An ACL fit and an ALSCL fit have different rows, so their heatmaps cannot be compared row by row. For a summary of both fits over the same ages, use plot_compare_F_ts(basis = "age").
Additional details from R help
ACL rows use the ages stored in each fit. The oldest age class is a
plus group and is marked with a plus sign, for example "Age 15+". Fits
saved without the ages show the numbers of the age classes. ALSCL rows
follow the
fitted length bins. An ACL fit and an ALSCL fit have different rows, so
their heatmaps cannot be compared row by row. For a summary of both fits
over the same ages, use plot_compare_F_ts(basis = "age").
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_compare_F(a, b)

plot_compare_F(a, b)