agelenPlot: Plots age given length from csPi, csData

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Plots age given length from the ca table of csData objects. Optionally can plot by a grouping variable, and specific factor levels within the grouping variable. The discarded and landed fractions of the catch can be plotted separately or together.

Usage

1
agelenPlot(x,by="spp",level="all",fraction=c("DIS","LAN"),title=TRUE,supsmu=FALSE,jitter=FALSE,...)

Arguments

x

An object of class csData or csDataVal

by

The character name of a grouping variable.

level

The level within the grouping variable, the default is "all".

fraction

The fraction of the catch to plot. DIS for discards, LAN for landings. The default is to plot both if present

title

Logical. adds a title to the outer margin

supsmu

Logical. Adds a running line smoother to the plotted points.

jitter

Logical. If "TRUE" jitters the plotted points, the default is false.

...

other arguments, particularly those to plot and lines.

Details

The possible options for the grouping variable are those within the amalgamated hl table produced by mergecsData and include for time: "year", "month" and "quarter"; for space: "area", and "rect"; for technical: "foCatNat","foCatEu5" and "foCatEu6". Other options include "proj", "trpCode", "commCat" and "sex". The default is to plot by "spp" so, for a single species data set, this will plot all length frequencies.

For plotting selected levels within the grouping variable the names of those levels can be passed as a vector to level, e.g just to plot data from the first quarter then set by ="quarter" and level=1. Grouping variables that are numeric, such as months and quarters, are specified as numerics e.g. level=c(1,3). Grouping variables that are characters are specified as character strings e.g. level=c("OTB_DEM")

Setting supsmu=TRUE fits a running line smoother, "super smoother" supsmu, to the plotted points. The span argument to this function, which takes values in the range (0-1) can be passed as an argument to ....

If jitter=TRUE age class values will be jittered, see jitter.

Other arguments that can be passed as ... include pch for setting the plotting character and col for setting the colour or the plotted points. If supsmu==TRUE then the colour of the fitted lines can be set using col.line, lty sets the line type and lwd the line width. pch, col, col.line, lwd and lty can all be passed a vector as arguments to enable the differetiation between levels of a grouping variable. Setting add=TRUE enables overlaying of multiple plots and for example, can be used to compare the fitted lines for a number of different levels of a grouping variable. If axes=FALSE no axes will be plotted. ylim sets the limits for the y axes and xlab and ylab are for axes labels. Other graphical parameters include main, sub, cex.main, cex.asis, cex.lab e.t.c see par for more details.

The outer margin default title is \"Length distribution of species by grouping variable\". This can be turned off if title=FALSE. The figure titles default to the argument passed as by and, if specified, level. This can be overwritten by a call to main. main="" will result in no figure title.

par(mfrow=c(nrow,ncol)) can be used to adjust the number of plots per page to accommodate the multiple figures generated when the grouping variable has more than one level.

Value

A named list of the grouping variable and levels plotted, each component of which is itself a list with components x and y, the coordinates of the fitted SuperSmoother. See supsmu for details.

Author(s)

Alastair Pout a.pout@marlab.ac.uk

See Also

lengthHist which plots length distributions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#data(cod2004cs)
# Plotting the age and length from the ca table for the cod data set 
#agelenPlot(cod2004cs)

# and now grouped by area and adding a smooth to the plotted points 
#par(mfrow=c(3,2))
#agelenPlot(cod2004cs,by="area",col=2,supsmu=TRUE,col.line=3,lwd=2,jitter=TRUE)

# and on the same plot 
#par(mfrow=c(1,1))
#areas <-1:6
#agelenPlot(cod2004cs,by="area",col=areas,pch=areas,supsmu=TRUE,col.line=areas,lwd=2,add=TRUE)

ldbk/fishPifct documentation built on May 20, 2019, 11:28 p.m.