plot_ts_mcmc: Plot MCMC time series plots for iSCAM models

View source: R/plot-ts-mcmc.R

plot_ts_mcmcR Documentation

Plot MCMC time series plots for iSCAM models

Description

Plot time series plots for MCMC output with credible intervals for single or multiple models

Usage

plot_ts_mcmc(
  models,
  quant_df = "sbt_quants",
  facet_wrap_var = c("none", "sex", "gear"),
  palette = iscam_palette,
  all_one_color = NULL,
  base_color = "black",
  legend_title = tr("Models"),
  x_label = tr("Year"),
  y_label = tr("Spawning Biomass (thousand t)"),
  append_base_txt = NULL,
  x_space = 0.5,
  y_space = 0,
  xlim = NULL,
  ylim = NULL,
  line_width = 1,
  point_size = 2,
  first_model_ribbon = TRUE,
  alpha = 0.2,
  leg_loc = c(1, 1),
  probs = c(0.025, 0.5, 0.975),
  text_title_size = 12,
  angle_x_labels = FALSE,
  ...
)

Arguments

models

A list of iscam model objects (class mdl_lst_cls)

quant_df

A name of a value which can be found in the model$mcmccalcs list for each iscam model in the models list

facet_wrap_var

A column in the quant_df data frame which will be used to split the output into separate panel plots. If "none", no faceting will be done

palette

A palette value that is in RColorBrewer::brewer.pal.info

all_one_color

If not NULL, overrides palette and the color that this is defined as will be used for all lines on the plot (all models)

base_color

A color to prepend to the brewer colors which are set by palette. This is called base_color because it is likely to be a base model

legend_title

Title for legend

x_label

The x-axis title label

y_label

The y-axis title label

append_base_txt

A vector of strings to append to the model names for display on the plot legend or title

x_space

The amount of x-interval space to pad the left and right of the plot with. To remove all padding, make this 0

y_space

The amount of y-interval space to pad the top and bottom of the plot with. To remove all padding, make this 0

xlim

The x limits for the plot. If NULL, the limits of the data will be used

ylim

The y limits for the plot. If NULL, the limits of the data will be used

line_width

Width of all median lines on the plot

point_size

Point size for all median points on the plot

first_model_ribbon

Logical. If TRUE, give the first model a shaded credible interval instead of dotted lines

alpha

The transparency with values from 0 to 1 of the ribbon shading when first_model_ribbon is TRUE

leg_loc

A two-element vector describing the X-Y values between 0 and 1 to anchor the legend to. eg. c(1, 1) is the top right corner and c(0, 0) is the bottom left corner

probs

A 3-element vector of probabilities that appear in the output data frames. This is provided in case the data frames have more than three different quantile levels

text_title_size

Add the model description as a title with this font size. The text comes from the model_desc attribute of model. If this is NULL, don't show a title

angle_x_labels

If TRUE put 45 degree angle on x-axis tick labels

...

Absorbs arguments meant for other functions

Details

Plot a single model or multiple models overlaid for comparison. If a single model, it must have a class attribute of mdl_cls. A list of multiple models must have a class attribute of mdl_lst_cls and each model in the list must have a class attribute of mdl_cls.

The model description text will appear in a legend if models length is greater than 1, and as a title if there is only one model. The description text is found in the model_desc attribute of a mdl_cls class ("iscam_model") object. The attribute is set in the model_setup() function, from either the bridge_model_text or sens_model_text arguments.

Value

A ggplot2::ggplot() object

See Also

Other Time series plotting functions: plot_biomass_grid_mcmc(), plot_biomass_mcmc(), plot_biomass_mpd(), plot_biomass_proj_mcmc(), plot_catch_fit_mcmc(), plot_f_mcmc(), plot_index_mcmc(), plot_index_mpd(), plot_q_mcmc(), plot_rdevs_mcmc(), plot_recr_grid_mcmc(), plot_recr_mcmc(), plot_recr_mpd(), plot_vuln_mcmc()


pbs-assess/gfiscamutils documentation built on Oct. 24, 2024, 1:37 p.m.