plotYieldVsSize: Plot the size distribution of the catch

View source: R/plots.R

plotYieldVsSizeR Documentation

Plot the size distribution of the catch

Description

Plots the normalised number density of the catch for a species as a function of either length or weight. In addition to the catch in the model, also the observed catch will be plotted if it is supplied via the catch argument. Also superimposes a plot of the number density of all individuals of the species.

Usage

plotYieldVsSize(
  object,
  species = NULL,
  gear = NULL,
  catch = NULL,
  x_var = c("Weight", "Length"),
  return_data = FALSE
)

plotlyYieldVsSize(
  object,
  species = NULL,
  gear = NULL,
  catch = NULL,
  x_var = c("Weight", "Length"),
  ...
)

Arguments

object

An object of class MizerSim or MizerParams.

species

The name of the predator species for which to plot the mortality.

gear

Optional. The name of a gear. If supplied, only the yield from this gear will be displayed.

catch

Data frame holding binned observed catch data. The data can be binned either into length bins or weight bins. In the former case the data frame should have columns length and dl holding the start of the size bins in cm and the width of the size bins in cm respectively. In the latter case the data frame should have columns weight and dw holding the start of the size bins in grams and the width of the size bins in grams. The data frame also needs to have the columns species (the name of the species), gear (the name of the gear) and catch (the number of individuals of a particular species caught by a particular gear in a size bin).

x_var

Determines whether to show the size distribution of the catch as a function of weight ("Weight") or as a function of length ("Length"). Default is "Weight".

return_data

A boolean value that determines whether the formatted data used for the plot is returned instead of the plot itself. Default value is FALSE

...

Other arguments (currently unused)

Value

A ggplot2 object, unless return_data = TRUE, in which case a list composed of two slots is returned. First slot is a data frame with the four variables 'w' or 'l' (depending on x_var), 'Catch density', 'Type', 'Species and the second slot is a data frame with the four variables 'w_mat', 'Species', 'y_coord', 'Type' (to plot vertical lines).

See Also

plotting_functions

Other plotting functions: plotDeath(), plotEnergyBudget(), plotResourceLevel(), plotResourcePred(), plotYieldVsF()

Examples


plotYieldVsSize(NS_params, species = "Cod")

# Returning the data frame
fr <- plotYieldVsSize(NS_params, species = "Cod", return_data = TRUE)
str(fr)


sizespectrum/mizerExperimental documentation built on Oct. 20, 2024, 4:09 a.m.