plotCDF() plots the cumulative distribution over body size from small to
large sizes. It uses the same spectra data preparation as plotSpectra():
the number density is multiplied by w^power and then integrated over size.
With normalise = TRUE, each curve is divided by its final value so that it
ends at 1.
Usage
plotCDF(
object,
species = NULL,
wlim = c(NA, NA),
llim = c(NA, NA),
ylim = c(NA, NA),
power = NULL,
biomass = NULL,
per_log_size = NULL,
total = FALSE,
resource = FALSE,
background = TRUE,
highlight = NULL,
normalise = TRUE,
log_x = TRUE,
log_y = FALSE,
log = NULL,
size_axis = c("w", "l"),
return_data = FALSE,
...
)Arguments
- object
An object of class MizerSim or MizerParams.
- 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) / 100whenresource = TRUE(to show some resource below the fish grid) ormin(params@w)whenresource = FALSE; the upper default ismax(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". UseNAto 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 aboveylim[2]is filtered and the upper axis limit is set accordingly.- power
The number density is multiplied by the weight raised to
powerbefore being integrated. An alternative to thebiomassargument, with which it must agree if that is given as well. The default ispower = 1, the cumulative biomass.- biomass
Whether to plot the cumulative biomass (
TRUE, the default) or the cumulative abundance (FALSE).- per_log_size
Only
FALSE(the default) is accepted; see Details.- total
A boolean value that determines whether the total is plotted as well. The total is the total of everything the object holds — every species and the resource — whatever is drawn, so it does not move when
species,resourceorbackgroundchange. 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. IfFALSE, 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 isFALSE.- log
Character string specifying which axes should use a log10 scale, in the same form as the base
plot()argument. If supplied, this overrideslog_xandlog_y.- size_axis
Whether to plot size as weight (
"w", default) or length ("l"), using the allometric weight-length relationship.- return_data
A boolean value that determines whether the formatted data used for the plot is returned instead of the plot itself. Default is FALSE.
- ...
Further arguments used by only some of the methods:
For
MizerSimmethods:time_range: The time range (either a vector of values, a vector of min and max time, or a single value) to average the abundances over. Default is the final time step.geometric_mean:If
TRUEthen the average of the abundances over the time range is a geometric mean instead of the default arithmetic mean.
Value
A ggplot2 object, unless return_data = TRUE, in which case a data
frame with the four variables 'w' (or 'l' if size_axis = "l"), 'value',
'Species', 'Legend' is returned. plotlyCDF() returns a plotly object.
Details
Unlike for plotSpectra(), the only choice that matters here is biomass:
whether to accumulate numbers or biomass. Whether a density is expressed
with respect to size or with respect to logarithmic size makes no difference
to its integral, because the change of variable cancels the factor of the
weight, and so plotCDF() does not accept per_log_size = TRUE.
plotlyCDF() is the interactive plotly version. To compare cumulative
distributions from two objects, use plotCDF2().
See also
Other plotting functions:
addPlot(),
animate(),
plot,
plot2(),
plotBiomass(),
plotCDF2(),
plotDiet(),
plotFMort(),
plotFeedingLevel(),
plotGrowthCurves(),
plotMizerParams,
plotMizerSim,
plotPredMort(),
plotRelative(),
plotSpectra(),
plotSpectra2(),
plotSpectraRelative(),
plotYield(),
plotYieldGear(),
plotYieldVsF(),
plotting_functions
Examples
# \donttest{
plotCDF(NS_params, species = c("Cod", "Herring"))
plotCDF(NS_sim, power = 0, normalise = FALSE)
# }
