plot_pla()
View source ↗On this page
Draw the probability that a fish of each age falls in each length bin (report$pla) as a heat map.
Usage
plot_pla(
model_result,
low_col = NULL,
high_col = NULL,
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 |
low_col | NULL | Character or NULL. Color of the low end of the probability gradient. NULL inherits the global low_col setting. |
high_col | NULL | Character or NULL. Color of the high end of the probability gradient. NULL inherits the global high_col setting. |
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 ylab$length 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 | Integer positions of the age classes to label (between 1 and the number of age classes). This changes tick labels only, never the heat map cells. NULL inherits the global x_breaks setting when all of its values are such positions; a global setting meant for another axis, for example calendar years, is ignored. Otherwise every age class is labelled. |
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, which can be styled further or saved with acl_save_plot().
Details
Each column of pla gives the probabilities of the length bins at one age; the highest length bin includes the upper tail of that age. ACL uses this matrix, which does not change over time, at every time step. ALSCL uses it to set the initial population and the lengths of recruits, and later length distributions follow growth and survival. In ALSCL, normalize the length vector of an age and time step in NLA to obtain the length distribution at that age and time step.
Columns are labelled with the fitted ages in model_result$age. The oldest age class is a plus group and is marked with a plus sign, for example "15+". A result saved without age metadata is labelled with the positions of the age classes, and the axis label reads "Age bin". plot_pla(b, x_breaks = c(1, 5, 10, 15)) selects the positions of the age classes to label without removing heat map cells.
Additional details from R help
Columns are labelled with the fitted ages in model_result$age.
The oldest age class is a plus group and is marked with a plus sign, for
example "15+". Results saved without age metadata keep the position
labels "Age bin 1", "Age bin 2" and so on.
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_pla(b, low_col = "white", high_col = "steelblue")

plot_pla(b)