comp_plot: Plot age or length composition data

View source: R/comp_plot.r

comp_plotR Documentation

Plot age or length composition data

Description

Plot age or length composition data

Usage

comp_plot(
  data_ob,
  data_pr = NULL,
  n1 = NULL,
  n2 = NULL,
  cc = NULL,
  data_type = "proportion",
  year_type = "year",
  title = "",
  xlab = "",
  ylab = NULL,
  ylim = NULL,
  addGrid = FALSE,
  byrow = FALSE,
  cex_n = 1.3,
  cex_year = 1.3,
  fillComp = TRUE,
  colFill = rgb(0, 0, 0, 0.5),
  vlines = NULL,
  signif_cc = 3,
  ...
)

Arguments

data_ob

observed composition data. numeric matrix

data_pr

predicted composition data with the same dimensions as data_ob. numeric matrix

n1

sample size by year associated with comps type 1 (e.g. number of trips)

n2

sample size by year associated with comps type 2 (e.g. number of fish)

cc

catch curve statistics output from bamExtras::catch_curve() function

data_type

Used in part of y-axis label. Specify type of data: "catch at age", "number at age", "proportion at age". character vector

year_type

Used in part of y-axis label. Specify type of data with respect to year: e.g. "year caught", "cohort year". character vector

ylab

will overwrite the y-axis label pasted together from data_type and year_type

vlines

values for adding vertical lines to plots. numeric vector

signif_cc

Number of significant digits to display when plotting catch curve statistics.

...

pass to plot

Author(s)

Nikolai Klibansky

Examples

## Not run: 
# read in commercial handline age comps used in the recent stock assessment
x <- rdat_BlackSeaBass$comp.mats$acomp.cHL.ob
n <- rdat_BlackSeaBass$t.series[rownames(x),c("acomp.cHL.n","acomp.cHL.nfish")]
# Plot comps by year
comp_plot(x)
# Add sample sizes
comp_plot(x,n1=n[,1],n2=n[,2])
# Plot comps and add catch curves (note the log-transformation of the composition data)
comp_plot(log(x),cc=catch_curve(x),fillComp = FALSE,ylab= "log(proportion)",xlab="age",title="black sea bass commercial handline catch curves")

## End(Not run)


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