Skip to content

plotDiet.MizerSim ignores time-varying abundance; no time_range parameter #357

@gustavdelius

Description

@gustavdelius

Description

plotDiet.MizerSim currently discards the simulation's time-varying abundance and delegates directly to plotDiet(object@params, ...):

plotDiet.MizerSim <- function(object, species = NULL, ...) {
    plotDiet(object@params, species = species, ...)
}

This is inconsistent with every other .MizerSim plot method (plotFeedingLevel, plotPredMort, plotFMort, plotSpectra, plotCDF, …), which all accept a time_range argument and compute the plotted quantity from the simulation's actual abundance at the specified time.

The diet composition can change over the course of a simulation as species abundances shift, so ignoring the simulated n may produce misleading results when the system is not at the initial equilibrium.

Suggested fix

Add a time_range parameter to plotDiet.MizerSim. Extract the abundance at (or averaged over) the specified time step and pass it to plot_diet instead of params@initial_n. If no time is supplied, default to the final time step (matching the convention in plotFeedingLevel and plotPredMort).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions