plot_with_uncertainty_discrete: Plot medians with uncertainty bars, such as for stock...

View source: R/plot-with-uncertainty-discrete.R

plot_with_uncertainty_discreteR Documentation

Plot medians with uncertainty bars, such as for stock assessment recruitment; called from 'plot.pacea_recruitment()'.

Description

Used for data for which the years are kind of discrete and so should not be joined up (like for recruitment, as opposed to biomass); helps distinguish plots also. Adapted from 'make.mcmc.recruitment.plot()' from Pacific Hake assessment.

Usage

plot_with_uncertainty_discrete(
  obj_lub,
  value,
  xlab,
  ylab,
  x_tick_extra_years,
  uncertainty_bar_col,
  y_min = 0,
  y_max,
  add_line_at_1,
  add_line_at_1_col,
  add_line_at_1_lty,
  ...
)

Arguments

obj_lub

obj a 'pacea_recruitment' object, which is a time series, with a date column that is the lubridate 'date' class. Can be absolute or relative recruitment (scaled by a particular year's recruitment or by assumed unfished equilibrium recruitment) or recruitment deviations.

value

the column to plot if no uncertainties, or what to plot as dots if showing uncertainties (likely always 'median')

xlab

x-axis label

ylab

y-axis label, the default is an attribute of the 'pacea_index' object.

x_tick_extra_years

number of extra years to expand around the range of data for which to add annual tick marks (does not expand the axis); in hindsight could have simplified this in 'add_tickmarks()', but just made the default big here.

uncertainty_bar_col

colour for uncertainty bars for certain types of plot (e.g. estimated fish recruitment)

y_min, y_max

minimum or maximum y value for certain types of plot (specify this instead of 'ylim'); recruitment deviations are positive and negative and so if not specified this will create symmetric y-axis ('y_min' = - 'y_max').

add_line_at_1

whether to add a horizontal line at 1 (only sensible for scaled recruitments)

add_line_at_1_col

colour for line at 1

add_line_at_1_lty

line type of line at 1

...

further options passed onto 'plot.default()'

Value

plot of time series with median as circle and bars for uncertainty.

Author(s)

Andrew Edwards

Examples

## Not run: 
# see plot.pacea_recruitment()

## End(Not run)

pbs-assess/PACea documentation built on April 17, 2025, 11:36 p.m.