monitor_timeseriesPlot: Create timeseries plot

View source: R/monitor_timeseriesPlot.R

monitor_timeseriesPlotR Documentation

Create timeseries plot

Description

Creates a time series plot of data from a mts_monitor object. By default, points are plotted as semi-transparent squares. All data values are plotted from all monitors found in the mts_monitor object.

Reasonable defaults are chosen for annotations and plot characteristics. Users can override any defaults by passing in parameters accepted by graphics::plot.default.

Usage

monitor_timeseriesPlot(
  monitor = NULL,
  id = NULL,
  shadedNight = FALSE,
  add = FALSE,
  addAQI = FALSE,
  palette = c("EPA", "subdued", "deuteranopia"),
  opacity = NULL,
  ...
)

Arguments

monitor

mts_monitor object.

id

deviceDeploymentID used to limit plotting to a single time series found in monitor.

shadedNight

Logical specifying whether to add nighttime shading.

add

Logical specifying whether to add to the current plot.

addAQI

Logical specifying whether to add visual AQI decorations.

palette

Named color palette to use when adding AQI decorations.

opacity

Opacity to use for points. By default, an opacity is chosen based on the number of points so that trends are highlighted while outliers diminish in visual importance as the number of points increases.

...

Additional arguments to be passed to graphics::plot.default().

Value

No return value. This function is called to draw an air quality time series plot on the active graphics device.

Examples

library(AirMonitor)

# Single monitor
Carmel_Valley %>%
  monitor_timeseriesPlot()

# Multiple monitors
Camp_Fire %>%
  monitor_filter(countyName == "Alameda") %>%
  monitor_timeseriesPlot(main = "All Alameda County Monitors")

# Standard extras
Carmel_Valley %>%
  monitor_timeseriesPlot(
    shadedNight = TRUE,
    addAQI = TRUE
  )
addAQILegend()

# Fancy plot based on pm2.5 values
pm2.5 <- Carmel_Valley$data[,2]
Carmel_Valley %>%
  monitor_timeseriesPlot(
    shadedNight = TRUE,
    pch = 16,
    cex = pmax(pm2.5 / 100, 0.5),
    col = aqiColors(pm2.5),
    opacity = 0.8
  )
addAQILegend(pch = 16, cex = 0.6, bg = "white")

AirMonitor documentation built on Aug. 26, 2023, 1:08 a.m.