tseries_plot: Time series plot

View source: R/tseries_plot.r

tseries_plotR Documentation

Time series plot

Description

This is a simple plotting fucntion that is useful when plotting time series typically found in stock assessments (e.g. catch, indices)

Usage

tseries_plot(
  x,
  err,
  errType = "sd",
  errStyle = "bands",
  errUnits = "SE",
  nErrUnits = 2,
  errLim = c(0, Inf),
  plotLabel = NULL,
  matplot_args = list(col = rainbow(ncol(x)), type = "o", lty = 1, lwd = 2, pch = 16,
    ylim = NULL),
  polygon_args = list(border = NA, lwd = matplot_args$lwd),
  col_band_alpha = 0.3,
  pt_buffer = 0.1,
  ...
)

Arguments

x

data frame of mean observations by year, where columns are different groups (e.g. fleets)

err

error values for each value in x. Must be same dimensions as x

errType

type of error provided: "cv"= coefficient of variation or "sd"=standard deviation. If "cv" then x is multiplied by err to compute sd.

errStyle

Style of displaying error around the central tendency time series x. Can be"bars" or "bands"

errUnits

Units of err. Used only for displaying text on plot (e.g. "SE")

nErrUnits

Multiplied by err to determine how far above and below x to to plot the errors

errLim

Range for limiting the plotting of error bars or bands.

plotLabel

character string for labeling plot

matplot_args

list of additional arguments passed to matplot, which plots x.

polygon_args

list of additional arguments passed to polygon, which plots error bands when errStyle="bands".

col_band_alpha

alpha (transparency) value between 0 and 1 to adjust opacity of color bands

...

pass additional arguments to matplot

ylim

range of y on plot

Author(s)

Nikolai Klibansky

Examples

## Not run: 
rdat <- rdat_BlackSeaBass
tser <- rdat$t.series
U <- tser[,grepl("^U.*ob$",names(tser))]
Ucv <- tser[,grepl("^cv.U.",names(tser))]
tseries_plot(U,Ucv,xlab="year",ylab="index of abundance",plotLabel=rdat$info$species)

## End(Not run)


nikolaifish/bamExtras documentation built on July 21, 2023, 8:26 a.m.