plot.pacea_recruitment: Plot a pacea recruitment time series object (currently...

View source: R/plot-pacea-recruitment.R

plot.pacea_recruitmentR Documentation

Plot a pacea recruitment time series object (currently assumes annual values)

Description

Temporal plot for a pacea recruitment time series (of class 'pacea_recruitment') object. The 'style' option here (unlike for 'plot.pacea_index()' defaults to 'no_uncertainty' and gets changed to 'uncertainty' if 'low' and 'high' are columns of 'obj'.

Usage

## S3 method for class 'pacea_recruitment'
plot(
  obj,
  value = "median",
  xlab = "Year",
  ylab = attr(obj, "axis_name"),
  y_tick_by = 1,
  x_tick_extra_years = 20,
  start_decade_ticks = lubridate::ymd("1800-01-01", truncated = 2),
  style = "no_uncertainty",
  uncertainty_bar_col = "blue",
  y_min = NULL,
  y_max = NULL,
  add_line_at_1 = FALSE,
  add_line_at_1_col = "darkgreen",
  add_line_at_1_lty = 2,
  ...
)

Arguments

obj

a 'pacea_recruitment' object, which is a time series. Function will run on other objects (not give an error) but is not tested on those.

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.

y_tick_by

increment for y-axis ticks; gets overwritten in 'add_tickmarks()' if this yields more than 'y_tick_max_number' tickmarks. If using [plot.pacea_biomass()] the default of 1 gets automatically changed to 0.25 for 'plot(hake_biomass)'.

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.

start_decade_ticks

where to start tickmarks for decades (defaults to 1800 as hard to automate)

style

'no_uncertainty' for plain time series without uncertainty, gets overridden to have uncertainty bars if 'low' and 'high' are columns of 'obj'

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 the time series as median with bars showing uncertainty (if 'low' and 'high' are columns of 'obj) to the current device; returns nothing.

Author(s)

Andrew Edwards

Examples

## Not run: 
plot(hake_recruitment)
plot(hake_recruitment,
     xlim = c(lubridate::dmy(01011950),
              lubridate::dmy(01012040))) # to expand x-axis
plot(hake_recruitment_over_2010)  # automatically changes style of plot
                                  #  if 'over' is in the object name
plot(hake_recruitment_deviations) # automatically plots with symmetric
                                  #  y-axis like in the assessment

## End(Not run)

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