plotSpectraRelative() plots the difference between the spectra relative to
their average. If we denote the number density from the first object as
\(N_1(w)\) and that from the second object as \(N_2(w)\), then this
plot shows
$$2 (N_2(w) - N_1(w)) / (N_2(w) + N_1(w)).$$
Note that it does not matter whether the relative difference is calculated
for number density, biomass density, or biomass density in log weight,
because the factors of \(w\) by which the densities differ cancel out in
the relative difference.
plotSpectraRelative(
object1,
object2,
species = NULL,
wlim = c(NA, NA),
llim = c(NA, NA),
ylim = c(NA, NA),
power = 1,
biomass = TRUE,
total = FALSE,
resource = TRUE,
background = TRUE,
highlight = NULL,
log_x = TRUE,
size_axis = c("w", "l"),
...
)A ggplot2 object. plotlySpectraRelative() returns a plotly object.
First MizerParams or MizerSim object.
Second MizerParams or MizerSim object.
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.
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.
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.
A numeric vector of length two providing lower and upper limits
for the y axis (the relative difference). Use NA to refer to the
existing minimum or maximum.
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.
Only used if
power argument is missing. Then
biomass = TRUE is equivalent to power=1 and
biomass = FALSE is equivalent to power=0
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.
A boolean value that determines whether resource is included. Default is TRUE.
A boolean value that determines whether background species are included. Ignored if the model does not contain background species. Default is TRUE.
Name or vector of names of the species to be highlighted by being plotted with thicker lines.
If TRUE (default), use a log10 x-axis.
Whether to plot size as weight ("w", default) or length
("l"), using the allometric weight-length relationship.
Additional arguments passed to plotSpectra() for preparing the
spectra data, for example time_range or geometric_mean for MizerSim
objects.
plotlySpectraRelative() is the interactive plotly version.
plotting_functions, plotSpectra(), plotSpectra2()
Other plotting functions:
addPlot(),
animate.ArrayTimeBySpeciesBySize(),
plot,
plot2(),
plotBiomass(),
plotCDF(),
plotCDF2(),
plotDiet(),
plotFMort(),
plotFeedingLevel(),
plotGrowthCurves(),
plotMizerParams,
plotMizerSim,
plotPredMort(),
plotRelative(),
plotSpectra(),
plotSpectra2(),
plotYield(),
plotYieldGear(),
plotting_functions
# \donttest{
sim1 <- project(NS_params, t_max = 10, progress_bar = FALSE)
sim2 <- project(NS_params, effort = 0.5, t_max = 10, progress_bar = FALSE)
plotSpectraRelative(sim1, sim2)
# }
Run the code above in your browser using DataLab