Learn R Programming

mizer (version 3.0.0)

plotCDF2: Compare cumulative abundance or biomass distributions from two objects

Description

plotCDF2() compares cumulative distributions from two MizerParams or MizerSim objects in a single plot. Colours identify species or groups and linetype identifies the object.

Usage

plotCDF2(
  object1,
  object2,
  name1 = "First",
  name2 = "Second",
  species = NULL,
  wlim = c(NA, NA),
  llim = c(NA, NA),
  ylim = c(NA, NA),
  power = 1,
  biomass = TRUE,
  total = FALSE,
  resource = FALSE,
  background = TRUE,
  highlight = NULL,
  normalise = TRUE,
  log_x = TRUE,
  log_y = FALSE,
  log = NULL,
  size_axis = c("w", "l"),
  ...
)

Value

A ggplot2 object. plotlyCDF2() returns a plotly object.

Arguments

object1

First MizerParams or MizerSim object.

object2

Second MizerParams or MizerSim object.

name1, name2

Labels for the two objects, used in the linetype legend.

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.

wlim

A numeric vector of length two providing lower and upper limits for the w axis. Use NA for the default: the lower default is min(params@w) / 100 when resource = TRUE (to show some resource below the fish grid) or min(params@w) when resource = FALSE; the upper default is max(params@w_full). Data is filtered to this range and the axis limits are set accordingly.

llim

A numeric vector of length two providing lower and upper limits for the length axis when size_axis = "l". Use NA to auto-scale to the data range. Data is filtered to this range and the axis limits are set accordingly.

ylim

A numeric vector of length two providing lower and upper limits for the y axis. Use NA to auto-scale to the data range. Values below 1e-20 are always filtered out from the data regardless of ylim[1]. Data above ylim[2] is filtered and the upper axis limit is set accordingly.

power

The abundance is plotted as the number density times the weight raised to power. The default power = 1 gives the biomass density, whereas power = 2 gives the biomass density with respect to logarithmic size bins.

biomass

[Deprecated] Only used if power argument is missing. Then biomass = TRUE is equivalent to power=1 and biomass = FALSE is equivalent to power=0

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.

resource

A boolean value that determines whether resource is included. Default is FALSE.

background

A boolean value that determines whether background species are included. Ignored if the model does not contain background species. Default is TRUE.

highlight

Name or vector of names of the species to be highlighted by being plotted with thicker lines.

normalise

If TRUE (default), plot the cumulative proportion. If FALSE, plot the cumulative abundance, biomass, or other unnormalised integral.

log_x

If TRUE (default), use a log10 x-axis.

log_y

If TRUE, use a log10 y-axis. Default is FALSE.

log

Character string specifying which axes should use a log10 scale, in the same form as the base plot() argument. If supplied, this overrides log_x and log_y.

size_axis

Whether to plot size as weight ("w", default) or length ("l"), using the allometric weight-length relationship.

...

Additional arguments passed to plotCDF() for preparing the cumulative distribution data, for example time_range or geometric_mean for MizerSim objects.

Details

plotlyCDF2() is the interactive plotly version.

See Also

plotSpectra(), plotCDF()

Other plotting functions: addPlot(), animate.ArrayTimeBySpeciesBySize(), plot, plot2(), plotBiomass(), plotCDF(), plotDiet(), plotFMort(), plotFeedingLevel(), plotGrowthCurves(), plotMizerParams, plotMizerSim, plotPredMort(), plotRelative(), plotSpectra(), plotSpectra2(), plotSpectraRelative(), plotYield(), plotYieldGear(), plotting_functions

Examples

Run this code
# \donttest{
sim1 <- project(NS_params, t_max = 10, progress_bar = FALSE)
sim2 <- project(NS_params, effort = 0.5, t_max = 10, progress_bar = FALSE)
plotCDF2(sim1, sim2, "Original", "Effort = 0.5")
# }

Run the code above in your browser using DataLab