siteplot: Summary plot of site-specific captures

View source: R/siteplot.R

siteplotR Documentation

Summary plot of site-specific captures

Description

Generate boxplot of captures for all sites, by year or species, with those from one site highlighted.

Usage

siteplot(data, site=0, year=0, visit=FALSE, splist=NULL, nspecies=20, nyears=NA, age=0, subset=NULL, effort=FALSE, ylab=NULL, margin=8, pch=21, pt.cex=2, pt.col='red', plot=TRUE, ...)

Arguments

data

either a dataframe generated by readces or a boxplot summary created by previously running siteplot, see details

site

character, the site to highlight

year

integer, specify a year to create a summary by species or visit

visit

logical, summarise catches within a year by visit number? If visit=FALSE (the default), catches will be summarised by species

splist

character, if a year is specified, optionally either a vector of Euring codes, or 'all' (not generally advised)

nspecies

numeric, if a year is specified and splist not, then plot the commonest 'n' species on the site

nyears

numeric, limit the number of years plotted to the number that the site operated, with this as a minimum. For example, if nyears=10 and the site has operated for 15 years, 15 bars (and dots) will be shown, but if the site has only operated for 5 years, then 10 bars will be plotted.

age

numeric, either 3 or 4 to select only juvenile or adult captures

subset

a logical expression to subset the data

effort

logical, should the number of captures be divided by netlength on the site?

ylab

character, a label for the number axis

margin

if year is specified, either a single number for the width of the left margin, or a vector of length 4 specifying each margin width, see details

pch

the symbol with which the site counts are plotted

pt.cex

size of the symbol with which the site counts are plotted

pt.col

colour of the symbol with which the site counts are plotted

plot

logical, should a plot be produced. For larger datasets, creating the summary data first without plotting may be helpful, see details

...

additional arguments passed to bxp for drawing the boxplot, such as 'main' (for a title) or 'whisklty' (change the whisker line type)

Details

Generates a boxplot of captures per site, with those from 'site' highlighted using an overlain point. Data may be summarised either annually (if year=0), or by species (if a year is specified). In the former case the boxes will be vertical, in the latter horizontal. The width of the margin(s) can be changed (by using margin=) if there is not enough room for the species names.

For larger datasets, creating the boxplot summaries may take some time. In this case it is advised to run the function with plot=FALSE to create the data for the boxplot. This can then be supplied to data=, meaning that only the individual site counts need to be extracted and plotted each time.

Value

A list with three components:

ds

the (subsetted) dataset

ds.bxp

data for the boxplot in summary form

ds.attr

some useful attributes

Note

It is assumed that this function will be used for current sites, so the nyears argument only counts backwards from the current year.

Author(s)

Rob Robinson

Examples

data(ukdata)
uk.bxp <- siteplot(ukdata, site='656')
siteplot(uk.bxp, site='420')

btorobrob/cesr documentation built on June 9, 2025, 5:39 a.m.