plotSpectra2() compares the abundance spectra from two MizerParams or
MizerSim objects in a single plot. Colours identify species or groups and
linetype identifies the object.
plotSpectra2(
object1,
object2,
name1 = "First",
name2 = "Second",
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 = TRUE,
background = TRUE,
highlight = NULL,
log_x = TRUE,
log_y = TRUE,
log = NULL,
size_axis = c("w", "l"),
...
)A ggplot2 object. plotlySpectra2() returns a plotly object.
First MizerParams or MizerSim object.
Second MizerParams or MizerSim object.
Labels for the two objects, used in the linetype legend.
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. 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.
The abundance is plotted as the number density times the weight
raised to power. An alternative to the biomass and per_log_size
arguments, with which it must agree if they are given as well; see
Details. The default is power = 1, the biomass density.
Whether to plot the biomass density (TRUE, the default) or
the number density (FALSE).
Whether to plot the density with respect to logarithmic
size (TRUE) or with respect to size (FALSE, the default).
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, resource or background change. 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.
If TRUE (default), use a log10 y-axis.
Character string specifying which axes should use log10 scales,
in the same form as the base plot() argument. For example, "x",
"y", "xy" or "". If supplied, this overrides log_x and log_y.
Whether to plot size as weight ("w", default) or length
("l"), using the allometric weight-length relationship. Spectrum
densities and their units are transformed to match the chosen axis.
Additional arguments passed to plotSpectra() for preparing the
spectra data, for example time_range or geometric_mean for MizerSim
objects.
plotlySpectra2() is the interactive plotly version.
plotting_functions, plotSpectra(), plotSpectraRelative()
Other plotting functions:
addPlot(),
animate(),
plot,
plot2(),
plotBiomass(),
plotCDF(),
plotCDF2(),
plotDiet(),
plotFMort(),
plotFeedingLevel(),
plotGrowthCurves(),
plotMizerParams,
plotMizerSim,
plotPredMort(),
plotRelative(),
plotSpectra(),
plotSpectraRelative(),
plotYield(),
plotYieldGear(),
plotYieldVsF(),
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)
plotSpectra2(sim1, sim2, "Original", "Effort = 0.5")
# }
Run the code above in your browser using DataLab