jbplot_ensemble: jbplot_ensemble()

View source: R/jbplot_ensemble.R

jbplot_ensembleR Documentation

jbplot_ensemble()

Description

Plots plots JABBA ensemble models + projections - joint or by run

Usage

jbplot_ensemble(
  kb,
  subplots = 1:6,
  joint = FALSE,
  plotCIs = TRUE,
  quantiles = c(0.025, 0.975),
  bfrac = 0.5,
  bref = c("bmsy", "b0")[1],
  reflines = TRUE,
  kbout = FALSE,
  ylabs = NULL,
  ylab.bref = NULL,
  plot = TRUE,
  as.png = FALSE,
  col = NULL,
  bref.col = "red",
  pch = NULL,
  lty = 1,
  lwd = 1.5,
  tickEndYr = FALSE,
  xlim = NULL,
  ylimAdj = 1.05,
  xaxs = "i",
  yaxs = "i",
  xylabs = TRUE,
  type = "l",
  legend = TRUE,
  legendlabels = "default",
  legend.loc = "topright",
  legendorder = "default",
  legendncol = 1,
  legendcex = 0.7,
  legendsp = 0.8,
  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 = FALSE,
  shadecol = NULL,
  shadealpha = 0.3,
  new = TRUE,
  add = FALSE,
  single.plots = add,
  run = NULL,
  fmax = 5
)

Arguments

kb

objects from fit_jabba(),jabba_fw(), list of fit_jabba() or fit_jabba()$kbtrj

subplots

option choose from subplots 1:7

  • 1: stock (B/Bmsy)

  • 2: harvest (F/Fmsy)

  • 3: B (Biomass)

  • 4: H (Harvest rate)

  • 5: Bdev (Process Deviations)

  • 6: Catch

  • 7: BB0 (B/K)

  • 8: BBfrac

joint

if true it creates a joint ensemble from list of fit_jabba()

plotCIs

Plot Credibilty Interval

quantiles

default is 95CIs as c(0.025,0.975)

bfrac

biomass fraction of Bmsy or B0 (subplot 8), default 0.5Bmsy

bref

biomass fraction reference options c("bmsy","b0")

reflines

if TRUE show reference point lines in absolute plots

kbout

if TRUE, produces the kb data.frame as output

ylabs

yaxis labels for quants

ylab.bref

option to only specify BBfrac plot ylab final year of values to show for each model. By default it is set to the

col

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

bref.col

option to set color for Bref reference line (default is "red")

pch

Optional vector of plot character values

lty

Optional vector of line types

lwd

Optional vector of line widths

tickEndYr

TRUE/FALSE switch to turn on/off extra axis mark at final year in timeseries plots.

xlim

= NULL range of years

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)

type

Type parameter passed to points (default 'o' overplots points on top of lines)

legend

Add a legend?

legendlabels

Optional vector of labels to include in legend.

legend.loc

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 ?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.

legendsp

Space between legend labels

pwidth

Width of plot

pheight

Height of plot

punits

Units for PNG file

res

Resolution for PNG file

ptsize

Point size for PNG file

cex.main

Character expansion for plot titles

plotdir

Directory where PNG or PDF files will be written. By default it will be the directory where the model was run.

filenameprefix

Additional text to append to PNG or PDF file names. It will be separated from default name by an underscore.

par

list of graphics parameter values passed to par() function

verbose

Report progress to R GUI?

shadecol

uncertainty shading of hcxval horizon

shadealpha

Transparency adjustment used to make default shadecol

new

Create new empty plot window

add

surpresses par() to create multiplot figs

run

name for single models or joint ensembles

legendcex=1

Allows to adjust legend cex

Author(s)

Mostly adopted from ss3diags::SSplotEnsemble

Examples

data(iccat)
bet = iccat$bet 
# Fit Fox and Schaefer
jb1 <- build_jabba(catch=bet$catch,cpue=bet$cpue,se=bet$se,scenario = "Fox",model.type="Fox")
jb2 <- build_jabba(catch=bet$catch,cpue=bet$cpue,se=bet$se,scenario = "Schaefer",model.type="Schaefer")
fit1 = fit_jabba(jb1,quickmcmc=TRUE,verbose=TRUE)
fit2 = fit_jabba(jb2,quickmcmc=TRUE,verbose=TRUE)
# Compare
jbplot_ensemble(list(fit1,fit2))
# Joint to 2-model ensemble
jbplot_ensemble(list(fit1,fit2),joint=T)
# Do 2-model ensemble forecast
prj = fw_jabba(list(fit1),quant="Catch",type="abs",imp.values = seq(60,100,1)*1000)
jbplot_ensemble(prj)
# Zoom in
jbplot_ensemble(prj,xlim=c(2000,2027))

jabbamodel/JABBA documentation built on Nov. 2, 2024, 12:50 p.m.