Skip to contents

Plots model ensembles and forecasts with uncertainty represented by MVLN or MCMC posteriors

Usage

SSplotEnsemble(
  kb,
  subplots = c("stock", "harvest", "SSB", "F", "Recr", "Catch"),
  models = "all",
  quantiles = list(c(0.025, 0.975)),
  ylabs = NULL,
  endyrvec = "default",
  plot = TRUE,
  print = deprecated(),
  print_plot = FALSE,
  png = deprecated(),
  use_png = print_plot,
  pdf = FALSE,
  use_pdf = FALSE,
  col = NULL,
  pch = NULL,
  lty = 1,
  lwd = 2,
  tickEndYr = FALSE,
  xlim = NULL,
  ylimAdj = 1.05,
  xaxs = "i",
  yaxs = "i",
  xylabs = TRUE,
  type = "l",
  uncertainty = TRUE,
  legend = TRUE,
  legendlabels = "default",
  legendloc = "topright",
  legendorder = "default",
  legendncol = 1,
  legendcex = 1,
  legendsp = 0.9,
  pwidth = 6.5,
  pheight = 5,
  punits = "in",
  res = 300,
  ptsize = 10,
  cex.main = 1,
  plotdir = NULL,
  filenameprefix = "",
  par = list(mar = c(5, 4, 1, 1) + 0.1),
  verbose = TRUE,
  shadealpha = 0.3,
  new = TRUE,
  add = FALSE,
  mcmcVec = FALSE,
  indexQlabel = TRUE,
  indexQdigits = 4,
  legendindex = NULL
)

Arguments

kb

kb type output created by SSdeltaMVLN()

subplots

vector to create subplots with these options:

  • "stock" Fish Population

  • "harvest" Harvest Rate

  • "SSB" Spawning Stock Biomass

  • "F" Fishing Mortality

  • "Recr" Recruitment

  • "Catch" Total Catch

models

option to manually subset the models in kb[["run"]]

quantiles

quantiles for uncertainty in plots. Input as a list, default is the 95TH percentile: list(c(0.025, 0.975))

ylabs

y-axis labels for quants

endyrvec

Optional single year or vector of years representing the final year of values to show for each model. By "default" it is set to the ending year specified in each model.

plot

DEPRECATED. By default, TRUE, Plots (and subplots) are drawn to the plot device. The option to explicitly disable this option (FALSE), is not implemented. This option flag will be defunct in a future version

print

DEPRECATED, please use print_plot.

print_plot

Flag to enable plot graphic device to print to PNG or PNG files.

png

DEPRECATED. Please use use_png.

use_png

Enables plots to be generated to PNG files. Defaults to print value

pdf

DEPRECATED. Please use use_pdf.

use_pdf

Enables plots to be generated to pdf file.

col

Optional vector of colors to be used for lines. Input NULL

pch

Optional vector of plot character values

lty

Optional vector of line types

lwd

Optional vector of line widths

tickEndYr

Logical flag: set TRUE or FALSE to switch to turn on/off extra axis mark at final year in timeseries plots.

xlim

Optional, years to use for x-axis. Default value NULL (or "default"), uses all years available.

ylimAdj

Multiplier for ylim parameter. Allows additional white space.

xaxs

Choice of xaxs parameter See ?par for more info.

yaxs

Choice of yaxs parameter. See ?par for more info.

xylabs

Logical flag: set TRUE or FALSE to include x- and y-axis labels to the plot. Defaults to TRUE

type

The type of plot to be drawn. For more details, see plot.

uncertainty

Logical flag to enable plots with uncertainty intervals. Either a single TRUE/FALSE value, or a vector of TRUE/FALSE values around SSB or F estimated timeseries, or a set of integers corresponding to the choice of models.

legend

Flag to enable legend to plot. TRUE by default.

legendlabels

Optional vector of labels to include in legend.

legendloc

Location of legend. Either a string like "topleft" or a vector of two numeric values representing the fraction of the maximum in the x and y dimensions, respectively. See help("legend") for more info on the string options.

legendorder

Optional vector of model numbers that can be used to have the legend display the model names in an order that is different than that which is represented in the summary input object.

legendncol

Number of columns for the legend.

legendcex

Allows to adjust legend cex

legendsp

Space between legend labels

pwidth

Default width of plot printed to plot in units of punits

pheight

Height of plot printed to plot in units of punits

punits

Measurement units for pwidth and pheight. Default is "in".

  • "px" (pixels)

  • "in" (inches)

  • "cm" (centimeters)

  • "mm" (millimeters)

res

Resolution for plots printed to files.

ptsize

Point size for plotted text in plots printed in files. See help("png") for more details

cex.main

Character expansion for plot titles.

plotdir

Directory where output plot file will be written. By default, it will be the directory where the model was run.

filenameprefix

Additional text to append to output plot file name. It will be separated from default name by an underscore.

par

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot,which is passed to par(). Entering NULL passes plot's default par() values (which depends on whether the main title is included or not)

verbose

Flag to print additional diagnostic messages to R console

shadealpha

Transparency adjustment used to make uncertainty regions, default is 0.3

new

Deprecated. New plot windows are created by default (TRUE), and the option to disable this, via FALSE, is unused.

add

suppresses par() to create multiplot figs

mcmcVec

Logical vector of TRUE/FALSE values (or single value) indicating whether input values are from MCMC or to use normal distribution around MLE.

indexQlabel

TRUE/FALSE include labels for indices. Default is TRUE (currently not used)

indexQdigits

Number of significant digits for catchability in legend. Default is 4

legendindex

Allows to add legend for selected indices (plots)

Author

Mostly adopted from r4ss::SSplotComparisons by Taylor et al

Examples

if (FALSE) { # \dontrun{

mvln <- SSdeltaMVLN(simple, run = "Simple")
sspar(mfrow = c(3, 2), plot.cex = 0.7)
SSplotEnsemble(mvln[["kb"]], ylabs = mvln[["labels"]], add = T, verbose = F)
} # }