Learn R Programming

mizer (version 1.0.1)

plotSpectra: Plot the abundance spectra

Description

What is plotted is the number density multiplied by a power of the weight, with the power specified by the power argument.

Usage

plotSpectra(object, ...)

# S4 method for MizerSim plotSpectra(object, species = NULL, time_range = max(as.numeric(dimnames(object@n)$time)), min_w = min(object@params@w)/100, ylim = c(NA, NA), power = 1, biomass = TRUE, print_it = TRUE, total = FALSE, plankton = TRUE, background = TRUE, ...)

# S4 method for MizerParams plotSpectra(object, species = NULL, min_w = min(object@w)/100, ylim = c(NA, NA), power = 1, biomass = TRUE, print_it = TRUE, total = FALSE, plankton = TRUE, background = TRUE, ...)

Arguments

object

An object of class '>MizerSim or '>MizerParams.

...

Other arguments (currently unused)

species

Name or vector of names of the species to be plotted. By default all species are plotted.

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. Ignored when called with a '>MizerParams object.

min_w

Minimum weight to be plotted (useful for truncating the background spectrum). Default value is a hundredth of the minimum size value of the community.

ylim

A numeric vector of length two providing limits of for the y axis. Use NA to refer to the existing minimum or maximum. Any values below 1e-20 are always cut off.

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

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

print_it

Display the plot, or just return the ggplot2 object. Defaults to TRUE

total

A boolean value that determines whether the total over all species in the system is plotted as well. Default is FALSE

plankton

A boolean value that determines whether plankton is included. Default is TRUE.

background

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

Value

A ggplot2 object

Details

When called with a '>MizerSim object, the abundance is averaged over the specified time range (a single value for the time range can be used to plot a single time step). When called with a '>MizerParams object the initial abundance is plotted.

Examples

Run this code
# NOT RUN {
data(NS_species_params_gears)
data(inter)
params <- MizerParams(NS_species_params_gears, inter)
sim <- project(params, effort=1, t_max=20, t_save = 2)
plotSpectra(sim)
plotSpectra(sim, min_w = 1e-6)
plotSpectra(sim, time_range = 10:20)
plotSpectra(sim, time_range = 10:20, power = 0)
plotSpectra(sim, species = c("Cod", "Herring"), power = 1)
# }

Run the code above in your browser using DataLab