plot_metab: Plot ecosystem metabolism for a swmpr object

View source: R/plot_metab.R

plot_metabR Documentation

Plot ecosystem metabolism for a swmpr object

Description

Plot gross production, total respiration, and net ecosystem metabolism for a swmpr object.

Usage

plot_metab(swmpr_in, ...)

## S3 method for class 'swmpr'
plot_metab(
  swmpr_in,
  by = "months",
  alpha = 0.05,
  width = 10,
  pretty = TRUE,
  ...
)

Arguments

swmpr_in

input swmpr object

...

arguments passed to or from other methods

by

chr string describing aggregation period, passed to aggremetab. See details for accepted values.

alpha

numeric indicating alpha level for confidence intervals in aggregated data. Use NULL to remove from the plot.

width

numeric indicating width of top and bottom segments on error bars

pretty

logical indicating use of predefined plot aesthetics

Details

A plot will only be returned if the metabolism attribute for the swmpr object is not NULL. Daily metabolism estimates are also aggregated into weekly averages. Accepted aggregation periods are 'years', 'quarters', 'months', 'weeks', and 'days' (if no aggregation is preferred).

By default, pretty = TRUE will return a ggplot object with predefined aesthetics. Setting pretty = FALSE will return the plot with minimal modifications to the ggplot object. Use the latter approach for easier customization of the plot.

Value

A ggplot object which can be further modified.

See Also

aggremetab, ecometab

Examples

## Not run: 
## import water quality and weather data
data(apadbwq)
data(apaebmet)

## qaqc, combine
wq <- qaqc(apadbwq)
met <- qaqc(apaebmet)
dat <- comb(wq, met)

## estimate metabolism
res <- ecometab(dat)

## plot
plot_metab(res)

## change alpha, aggregation period, widths
plot_metab(res, by = 'quarters', alpha = 0.1, widths = 0)

## plot daily raw, no aesthetics
plot_metab(res, by = 'days', pretty = FALSE)

## note the difference if aggregating with a moving window average
plot_metab(res, by = 30)

## End(Not run)

SWMPr documentation built on July 26, 2023, 5:20 p.m.