Bubble plot of compositions by year (x-axis) and bin (y-axis). Bubbles can show the observed (or expected) proportions, which makes strong and weak cohorts easy to follow through time, or the Pearson residuals, which show blocks or stripes of misfit among years or bins.
plot_composition_bubble(
dat,
value = c("observed", "pearson", "expected"),
comp_type = NULL,
fleet = NULL,
max_size = 6,
ncol = NULL,
direction = "v",
conditional = FALSE
)A tibble returned from convert_output() that contains
composition data (see bigskate_lencomp), or composition data in any other
format accepted by prepare_composition_data().
String. Value to plot. Options: "observed", "expected", or "pearson". Default: "observed"
String. Type of composition to keep when dat contains
more than one. Options: "age", "length", or NULL (keep all). Default: NULL
Character or numeric vector. Fleet(s) to keep, matching either the fleet name (e.g., "Fishery_current") or the fleet name with its partition (e.g., "Fishery_current (retained)"). NULL keeps all fleets. Default: NULL
Number. Size of the largest bubble. Default: 6
Number. Number of facet columns. NULL lets ggplot2 choose. Default: NULL
String. Order of the panels: "v" fills panels down each column and then across, so consecutive years are stacked vertically and cohorts are easier to follow from panel to panel; "h" fills panels across each row.
Default: "v"
Logical. TRUE/FALSE; plot conditional age-at-length
data (see prepare_composition_data()), with age on the y-axis, length bin on
the x-axis, and one panel per year. Default: FALSE
A ggplot2 object.
Panels are created for each fleet, and for each sex when compositions are sex-specific. For Pearson residuals, filled bubbles are positive residuals (observed > expected) and open bubbles are negative residuals (observed < expected), with bubble area proportional to the absolute value of the residual. The maximum absolute residual for each panel is included in the panel label.
r4ss: r4ss::SSplotComps() subplot 2 (bubble plot of
observations or residuals) and subplot 3 (conditional age-at-length).
# Observed proportions
plot_composition_bubble(bigskate_lencomp)
# Pearson residuals
plot_composition_bubble(bigskate_lencomp, value = "pearson")
# Residuals for conditional age-at-length data
plot_composition_bubble(
dplyr::filter(bigskate_caal, year %in% 2016:2018),
value = "pearson",
fleet = "WCGBTS",
conditional = TRUE
)