alkPlot: Plots to visualize age-length keys.

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

View source: R/alkPlot.R

Description

Various plots to visualize the proportion of fish of certain ages within length intervals in an age-length key.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
alkPlot(
  key,
  type = c("barplot", "area", "lines", "splines", "bubble"),
  xlab = "Length",
  ylab = ifelse(type != "bubble", "Proportion", "Age"),
  xlim = NULL,
  ylim = NULL,
  showLegend = FALSE,
  lbl.cex = 1.25,
  leg.cex = 1,
  lwd = 2,
  span = 0.25,
  grid = TRUE,
  col = NULL,
  buf = 0.45,
  add = FALSE,
  ...
)

Arguments

key

A numeric matrix that contains the age-length key.

type

A string that indicates the type of plot to construct. See details.

xlab, ylab

A string that contains the label for the x- or y-axis.

xlim, ylim

A numeric of length 2 that provide the limits for the x-axis or y-axis.

showLegend

A logical that indicates whether a legend should be displayed (not implemented for type="bubble"). See examples.

lbl.cex

A numeric character expansion value for labels inside the bars when type="barplot" or on the lines when type="lines" or type="splines". Only used if showLegend=FALSE.

leg.cex

A numeric character expansion value for labels on the legend when showLegend=TRUE.

lwd

A numeric that indicates the line width when type="lines" or type="splines".

span

A numeric that indicates the span value to use in loess when type="splines".

grid

A logical that indicates whether a grid should be placed under the bubbles when type="bubble" or a character or appropriate vector that identifies a color for the grid. See examples.

col

A single character string that is a palette from hcl.pals or a vector of character strings containing colors for the bars, areas, lines, or spline lines of different ages; defaults to the "viridis" palette in hcl.colors. A single string that indicates the color of the bubbles when type="bubble".

buf

A single numeric that indicates the relative width of the bubbles when type="bubble". A value of 0.5 means that two full-width bubbles would touch each other either in the x- or y-direction (i.e., this would represent half of the minimum of the physical distance between values one-unit apart on the x- and y-axes). Set this to a value less than 0.5 so that the bubbles will not touch (the default is 0.45).

add

A logical that indicates whether the data should be added to an already existing plot. May be useful for visually comparing age-length keys. Only implemented when type="bubble".

...

Additional arguments to pass to plot or barplot.

Details

A variety of plots can be used to visualize the proportion of fish of certain ages within length intervals of an age-length key. The types of plots are described below and illustrated in the examples.

Note that all plots are “vertically conditional” – i.e., each represents the proportional ages WITHIN each length interval.

Value

None, but a plot is constructed.

IFAR Chapter

5-Age-Length Key.

Author(s)

Derek H. Ogle, derek@derekogle.com

References

Ogle, D.H. 2016. Introductory Fisheries Analyses with R. Chapman & Hall/CRC, Boca Raton, FL.

See Also

See alkIndivAge for using an age-length key to assign ages to individual fish. See hcl.colors for a simple way to choose other colors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Make an example age-length key
WR.age <- droplevels(subset(WR79, !is.na(age)))
WR.age$LCat <- lencat(WR.age$len,w=5)
raw <- xtabs(~LCat+age,data=WR.age)
WR.key <- prop.table(raw, margin=1)
round(WR.key,3)

## Various visualizations of the age-length key
alkPlot(WR.key,"barplot")
alkPlot(WR.key,"barplot",col="Cork")
alkPlot(WR.key,"barplot",col=heat.colors(8))
alkPlot(WR.key,"barplot",showLegend=TRUE)
alkPlot(WR.key,"area")
alkPlot(WR.key,"lines")
alkPlot(WR.key,"splines")
alkPlot(WR.key,"splines",span=0.2)
alkPlot(WR.key,"bubble")
alkPlot(WR.key,"bubble",col=col2rgbt("black",0.5))

FSA documentation built on July 17, 2021, 5:07 p.m.

Related to alkPlot in FSA...