Skip to contents

The growth curves represent the average age of all the living fish of a species as a function of their size. So it would be natural to plot size on the x-axis. But to follow the usual convention from age-based models, we plot size on the y-axis and age on the x-axis.

Usage

plotGrowthCurves(
  object,
  species = NULL,
  max_age = 20,
  percentage = FALSE,
  species_panel = FALSE,
  highlight = NULL,
  size_at_age = NULL,
  return_data = FALSE,
  ...
)

plotlyGrowthCurves(
  object,
  species = NULL,
  max_age = 20,
  percentage = FALSE,
  species_panel = FALSE,
  highlight = NULL
)

Arguments

object

MizerSim or MizerParams object. If given a MizerSim object, uses the growth rates at the final time of a simulation to calculate the size at age. If given a MizerParams object, uses the initial growth rates instead.

species

The species to be selected. Optional. By default all target species are selected. A vector of species names, or a numeric vector with the species indices, or a logical vector indicating for each species whether it is to be selected (TRUE) or not.

max_age

The age up to which to run the growth curve. Default is 20.

percentage

Boolean value. If TRUE, the size is given as a percentage of the maximal size.

species_panel

If TRUE (default), and percentage = FALSE, display all species as facets. Otherwise puts all species into a single panel.

highlight

Name or vector of names of the species to be highlighted.

size_at_age

A data frame with observed size at age data to be plotted on top of growth curve graphs. Should contain columns species (species name as used in the model), age (in years) and either weight (in grams) or length (in cm). If both weight and length are provided, only weight is used.

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

Details

When the growth curve for only a single species is plotted, horizontal lines are included that indicate the maturity size and the maximum size for that species, as well as a vertical line indicating the maturity age.

If size at age data is passed via the size_at_age argument, this is plotted on top of the growth curve. When comparing this to the growth curves, you need to remember that the growth curves should only represent the average age at each size. So a scatter in the x-direction around the curve is to be expected.

For legacy reasons, if the species parameters contain the variables a and b for length to weight conversion and the von Bertalanffy parameter k_vb, w_inf (and optionally t0), then the von Bertalanffy growth curve is superimposed in black. This was implemented before we understood that the von Bertalanffy curves (which approximates the average length at each age) should not be compared to the mizer growth curves (which approximate the average age at each length).

Examples

# \donttest{
params <-  NS_params
sim <- project(params, effort=1, t_max=20, t_save = 2, progress_bar = FALSE)
plotGrowthCurves(sim, percentage = TRUE)

plotGrowthCurves(sim, species = "Cod", max_age = 24)

plotGrowthCurves(sim, species_panel = TRUE)


# Returning the data frame
fr <- plotGrowthCurves(sim, return_data = TRUE)
str(fr)
#> 'data.frame':	600 obs. of  4 variables:
#>  $ Species: Factor w/ 12 levels "Sprat","Sandeel",..: 1 2 3 4 5 6 7 8 9 10 ...
#>  $ Age    : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ value  : num  0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 ...
#>  $ Legend : chr  "model" "model" "model" "model" ...
# }