plotSpectraRelative: Plot the relative difference between two spectra

View source: R/plotRelative.R

plotSpectraRelativeR Documentation

Plot the relative difference between two spectra

Description

This plots the difference between the spectra relative to their average. So 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)).

Usage

plotSpectraRelative(object1, object2, ...)

plotlySpectraRelative(object1, object2, ...)

Arguments

object1

An object of class MizerSim or MizerParams

object2

An object of class MizerSim or MizerParams

...

Parameters passed to plotSpectra()

Details

The individual spectra are calculated by the plotSpectra() function which is passed all additional arguments you supply. So you can for example determine a size range over which to average the simulation results via the time_range argument. See plotSpectra() for more options.

Note that it does not matter whether the relative difference is calculated for the number density or the biomass density or the biomass density in log weight because the factors of w by which the densities differ cancels out in the relative difference.

Value

A ggplot2 object

Examples

sim1 <- project(NS_params, t_max = 10)
sim2 <- project(NS_params, effort = 0.5, t_max = 10)
plotSpectraRelative(sim1, sim2)

sizespectrum/mizerExperimental documentation built on April 16, 2024, 8:39 a.m.