Skip to contents

Creates a heatmap showing the scaling of refuge density across bleaching years and refuge size bins for a given degradation trajectory. The input data should have refuge size bins as rows and bleaching years as columns (column 1 = bleaching year, remaining columns = years 1, 2, 3... post- bleaching), matching the format of the built-in trajectory objects (e.g. rubble_scale) and of deg_scale as used by reefDegrade().

Usage

plotDegradationScale(object = NULL, trajectory = NULL, return_data = FALSE)

Arguments

object

An optional object of class MizerParams or MizerSim. If provided, the function will attempt to extract the degradation scaling or trajectory from its @other_params$refuge_params slot.

trajectory

Optional. Either a character string ("rubble", "algae", "recovery") to use built-in data, or a user-provided numeric matrix/data.frame with refuge size bins as rows and bleaching years as columns (column 1 = bleaching year, remaining columns = years 1, 2, 3... post-bleaching).

return_data

Logical. If TRUE, returns the formatted data frame instead of the plot. Default FALSE.

Value

A ggplot2 object (heatmap), or a data frame if return_data = TRUE.

Details

This function is flexible in its input:

  • If trajectory is provided, it takes precedence. It can be:

    • A character string ("rubble", "algae", "recovery") to use built-in data.

    • A user-provided numeric matrix or data.frame with refuge size bins as rows and bleaching years as columns (column 1 = bleaching year, remaining columns = years 1, 2, 3... post-bleaching).

  • If trajectory is not provided, object must be supplied and can be a MizerParams or MizerSim object. The function will extract the degradation scaling or trajectory from object@other_params$refuge_params$trajectory or object@other_params$refuge_params$deg_scale.