Skip to contents

A function to plot SSB, B-ratio, F, Recruits, and/or Index of Abundance fits from multiple SS models. This function uses an object of multiple SS models summarized with r4ss::SSsummarize().

Usage

SSplotModelcomp(
  summaryoutput,
  plot = TRUE,
  print = deprecated(),
  print_plot = FALSE,
  png = deprecated(),
  use_png = print_plot,
  pdf = deprecated(),
  use_pdf = FALSE,
  models = "all",
  subplots = c("SSB", "Bratio", "Fvalue", "Recruits", "Index", "RecDevs"),
  brp = c("msy", "btargs"),
  fmsy = TRUE,
  ylabs = c("SSB (t)", expression(SSB/SSB[MSY]), "Fishing mortality F",
    "Recruits ('000s)", "Index", "Recruitment Deviations"),
  endyrvec = "default",
  xmin = NULL,
  indexselect = NULL,
  indexUncertainty = TRUE,
  col = NULL,
  pch = NULL,
  lty = 1,
  lwd = 2,
  tickEndYr = FALSE,
  xlim = "default",
  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,
  legendindex = NULL,
  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,
  shadecol = NULL,
  shadealpha = 0.3,
  new = TRUE,
  add = FALSE,
  mcmcVec = FALSE,
  indexQlabel = TRUE,
  indexQdigits = 4,
  indexfleets = 1
)

Arguments

summaryoutput

List created by r4ss::SSsummarize()

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.

models

Optional subset of the models of summaryoutput (or a similar field with a different name): a list created by the function r4ss::SSsummarize. Either "all" or a vector of numbers indicating columns in summary tables.

subplots

option to "SSB","Bratio","Fvalue","Recruits","Index"

  • "SSB" Spawning Stock Biomass

  • "Bratio" Stock Biomass relative to biomass reference point

  • "Fvalue" Fishing Mortality

  • "Recruits" Age-0 Recruits

  • "Index" Index of abundance

  • "RecDev" Recruitment Deviations

brp

option to set reference point c("msy","btargs")

fmsy

to specify Fvalue as F/Fmsy if so in starter file setting

ylabs

yaxis labels for quants final year of values to show for each model. By default it is set to the

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.

xmin

NULL optional number first year shown in plot (if available)

indexselect

Vector of fleet numbers for each model for which to compare

indexUncertainty

Show fixed uncertainty intervals on index (not estimated)

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

legendindex

Allows to add legend for selected indices (plots)

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

shadecol

uncertainty shading of hcxval horizon

shadealpha

Transparency adjustment used to make default shadecol

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

Logical. If TRUE add catchability to legend in plot of index fits (currently not used)

indexQdigits

Number of significant digits for catchability in legend

indexfleets

Fleet numbers for each model to compare indices of abundance. Can take different forms:

  • integer (default): create a single comparison plot for the chosen index

  • NULL: create a separate plot for each index as long as the fleet numbering is the same across all models.

  • vector of length equal to number of models: a single fleet number for each model to be compared in a single plot

  • list: list of fleet numbers associated with indices within each model to be compared, where the list elements are each a vector of the same length but the names of the list elements don't matter and can be absent.

Author

Mostly adopted from r4ss::SSplotComparisons by Taylor et al