plot.pacea_biomass: Plot a pacea biomass time series object (currently assumes...

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

plot.pacea_biomassR Documentation

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

Description

Temporal plot for a pacea biomass time series (of class 'pacea_biomass') 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_biomass'
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",
  y_max = NULL,
  y_tick_max_number = 50,
  uncertainty_shade_col = rgb(0, 0, 1, 0.1),
  uncertainty_line_col = "blue",
  uncertainty_line_lty = 3,
  median_type = "o",
  median_pch = 16,
  median_line_col = "black",
  median_line_lty = 1,
  median_line_lwd = 2,
  ...
)

Arguments

obj

a 'pacea_biomass' 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'

y_max

maximum y value for certain types of plot (use this if you get an error when specifying 'ylim')

y_tick_max_number

maximum number of y tickmarks.

uncertainty_shade_col

colour of shading for uncertainty

uncertainty_line_col

colour of line for uncertainty

uncertainty_line_lty

lty of line for uncertainty

median_type

'type' of plot ("o", "p", etc.) for medians

median_pch

pch for median

median_line_col

col for median

median_line_lty

lty for median

median_line_lwd

lwd for median

...

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_biomass)
plot(hake_biomass,
     xlim = c(lubridate::dmy(01011950),
              lubridate::dmy(01012040))) # to expand x-axis

## End(Not run)

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