Learn R Programming

mizer (version 0.4)

plotSpectra: Plot the abundance spectra of each species and the background population

Description

After running a projection, the spectra of the abundance of each species and the background population can be plotted. 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). The abundance can be in terms of numbers or biomass, depending on the biomass argument.

Plot the abundance spectra using a MizerSim object.

Usage

plotSpectra(object, ...)

# S4 method for MizerSim plotSpectra(object, time_range = max(as.numeric(dimnames(object@n)$time)), min_w = min(object@params@w)/100, biomass = TRUE, print_it = TRUE, ...)

Arguments

object

An object of class MizerSim.

...

Other arguments (currently unused)

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.

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.

biomass

A boolean value. Should the biomass spectrum (TRUE) be plotted or the abundance in numbers (FALSE). Default is TRUE.

print_it

Display the plot, or just return the ggplot2 object

Value

A ggplot2 object

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, biomass = FALSE)
# }

Run the code above in your browser using DataLab