Skip to contents

This is a useful function for examining short-term data after it has been filtered or aggregated, but before it statistics are calculated. Unlike other plotting functions in {mqor}, this function does not take the output of summarise_mqo_stats().

Usage

plot_timeseries(
  data,
  pollutant,
  site,
  color_obs = "#6CC5B0",
  color_mod = "black",
  title = NULL,
  dict = mqor::mqo_dict(),
  interactive = FALSE
)

Arguments

data

An R data.frame containing at least four columns; a numeric column of observed values, a numeric column of modelled values, a character or factor column of identifiers that identify the site associated with the concentrations, and a character or factor column of identifiers that identify the pollutant being measured/modelled. See demo_shortterm for an example format.

pollutant

The pollutant to plot. Should be a value contained within data[[dict$pollutant]].

site

The station to plot.s Should be a value contained within data[[dict$site]].

color_obs, color_mod

The colours to use for the 'observation' and 'modelled' lines. Can be expressed as hex codes, or any colours listed in colors().

title

An optional title for the plot. This will appear directly above the plot area, regardless of whether interactive is TRUE or FALSE.

dict

See mqo_dict() for more information. Acts as a data dictionary to specify the columns in the data {mqor} should use.

interactive

If FALSE, the default, a static ggplot2 graphic will be returned which can be saved as a PNG, SVG, or other similar format. If TRUE, a dynamic HTML widget will be returned created by plotly.

Author

Jack Davison