compyear: compyear plots a histogram of a variable for each year...

View source: R/catchcurve.r

compyearR Documentation

compyear plots a histogram of a variable for each year available

Description

compyear plots a histogram of either ages or lengths for each year available. It assumes the data are available as counts in columns, one for each age/length class with a row for each year. These can be plotted as frequencies or proportions, with flexibility in colouring, column widths, and other details of the plots.

Usage

compyear(
  x,
  yrs,
  comps,
  plots = c(length(x[, 1]), 1),
  freq = TRUE,
  varlabel = NA,
  width = 0.9,
  col = 2,
  border = 2,
  lwd = 1,
  xmin = NA,
  xmax = NA,
  inc = 1,
  xaxis = TRUE,
  vline = 0
)

Arguments

x

a matrix of years (rows) by counts (cols)

yrs

the labels for each row of x

comps

the ages or lengths to be plotted on the x-axis

plots

number of rows and columns, defaults to c(length(x[,1]),1)

freq

plot numbers 'freq' or proportions; default = TRUE

varlabel

what label to use on x-axis, default = NA

width

the width of each column in the histogram, default = 0.8

col

colour of each cell; defaults to 2 (red)

border

colour of the border of each cell, default = 2 (red)

lwd

the width of the line around each polygon, default = 1

xmin

starting value for xaxis, default = NA, so input range used

xmax

end value for xaxis, default = NA, so input range used

inc

the steps along xaxis, default = 1

xaxis

if FALSE then a custom xaxis is plotted, default is TRUE

vline

optionally plot a vertical on each plot, default = 0 = no line

Value

currently it returns nothing although it does generate a plot.

Examples

## Not run: 
indat <- c(95,2898,3017,1159,591,116,100,82,33,77,606,4385,1186,231,
           138,42,21,51,50,489,1121,4738,456,106,80,27,18)
naa <- matrix(indat,nrow=3,ncol=9,byrow=TRUE)
yrs <- c(1931,1932,1933)
ages <- 2:10
plotprep()
compyear(naa,yrs,ages,plots=c(2,2),freq=TRUE,border=3)

## End(Not run) # x=naa;yrs=yrs;comps=ages;plots=c(3,3);freq=TRUE;border=3
  # varlabel=NA;width=0.9;col=2;lwd=1;xmin=NA;xmax=NA;inc=1;xaxis=TRUE;vline=0

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.