plotYield: Plot the total yield of species through time

View source: R/plots.R

plotYieldR Documentation

Plot the total yield of species through time

Description

After running a projection, the total yield of each species across all fishing gears can be plotted against time. The yield is obtained with getYield().

Usage

plotYield(
  sim,
  sim2,
  species = NULL,
  total = FALSE,
  log = TRUE,
  highlight = NULL,
  return_data = FALSE,
  ...
)

plotlyYield(
  sim,
  sim2,
  species = NULL,
  total = FALSE,
  log = TRUE,
  highlight = NULL,
  ...
)

Arguments

sim

An object of class MizerSim

sim2

An optional second object of class MizerSim. If this is provided its yields will be shown on the same plot in bolder lines.

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.

total

A boolean value that determines whether the total over all species in the system is plotted as well. Note that even if the plot only shows a selection of species, the total is including all species. Default is FALSE.

log

Boolean whether yield should be plotted on a logarithmic axis. Defaults to true.

highlight

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

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 data frame with the three variables 'Year', 'Yield', 'Species' is returned.

See Also

plotting_functions, getYield()

Other plotting functions: animateSpectra(), plot,MizerParams,missing-method, plot,MizerSim,missing-method, plotBiomass(), plotDiet(), plotFMort(), plotFeedingLevel(), plotGrowthCurves(), plotPredMort(), plotSpectra(), plotYieldGear(), plotting_functions

Examples


params <- NS_params
sim <- project(params, effort = 1, t_max = 20, t_save = 0.2, progress_bar = FALSE)
plotYield(sim)
plotYield(sim, species = c("Cod", "Herring"), total = TRUE)

# Comparing with yield from twice the effort
sim2 <- project(params, effort=2, t_max=20, t_save = 0.2, progress_bar = FALSE)
plotYield(sim, sim2, species = c("Cod", "Herring"), log = FALSE)

# Returning the data frame
fr <- plotYield(sim, return_data = TRUE)
str(fr)


mizer documentation built on Oct. 17, 2024, 9:07 a.m.