Skip to contents

Plot length frequency (LF) fit for longline or CPUE length compositions.

Usage

plot_lf(
  fit = NULL,
  object = NULL,
  posterior = NULL,
  probs = c(0.025, 0.975),
  years = NULL,
  fishery = "LL1",
  observed_color = "#D55E00",
  predicted_color = "#0072B2",
  data = NULL,
  ...
)

Arguments

fit

An sbt_fit object. Stored MCMC is used by default when the plot supports posterior output.

object

Legacy RTMB objective used only with a legacy data-list input.

posterior

Use NULL to plot the fit's required embedded composition posterior summary, or FALSE for point estimates only. External posterior objects are not accepted.

probs

A numeric vector of length 2 with probabilities in [0,1] for plotting quantiles of the posterior distribution. Default is c(0.025, 0.975).

years

A numeric vector of years to plot. If NULL (default), all years are plotted.

fishery

A character vector specifying the fishery or fisheries to plot. Options are "LL1", "LL2", "LL3", "LL4", and "CPUE". Default is "LL1".

observed_color

Color used for observed proportions.

predicted_color

Color used for predicted proportions and intervals.

data

Legacy named alias for a model data list; supply object as well.

...

Additional parameters passed on to facet_wrap.

Value

A ggplot2 object displaying observed and predicted length frequencies by year.

Details

The plotting centers are currently fixed at 25 bins from 87.5 cm in 4-cm increments and must match the model-prepared LF matrices.

Examples

fit <- sbt_example_fit()
#> Warning: Dependency versions differ: RTMBdist, TMB
#> Warning: Dependency versions differ: RTMBdist, TMB
plot_lf(fit, posterior = FALSE, years = 2020:2022, fishery = "LL1")