Learn R Programming

PWFSLSmoke (version 1.0.16)

monitorPlot_timeseries: Create Timeseries Plot

Description

Creates a time series plot of PM2.5 data from a ws_monitor object (see note below). Optional arguments color code by AQI index, add shading to indicate nighttime, and adjust the time display (local vs. UTC).

When a named style is used, some graphical parameters will be overridden. Available styles include:

  • aqidots-- hourly values are individually colored by 24-hr AQI levels

  • gnats-- semi-transparent dots like a cloud of gnats

Usage

monitorPlot_timeseries(ws_monitor, monitorID = NULL, tlim = NULL,
  localTime = TRUE, style = NULL, shadedNight = FALSE, add = FALSE,
  gridPos = "", gridCol = "black", gridLwd = 1, gridLty = "solid",
  dayLwd = 0, hourLwd = 0, hourInterval = 6, ...)

Arguments

ws_monitor

ws_monitor object

monitorID

monitor ID for one or more monitor in the ws_monitor object

tlim

optional vector with start and end times (integer or character representing YYYYMMDD[HH])

localTime

logical specifying whether tlim is in local time or UTC

style

custom styling, one of 'aqidots'

shadedNight

add nighttime shading

add

logical specifying whether to add to the current plot

gridPos

position of grid lines either 'over', 'under' ('' for no grid lines)

gridCol

grid line color

gridLwd

grid line width

gridLty

grid line type

dayLwd

day marker line width

hourLwd

hour marker line width

hourInterval

interval for grid (max=12)

...

additional arguments to be passed to points()

Examples

Run this code
# NOT RUN {
N_M <- Northwest_Megafires
# monitorLeaflet(N_M) # to identify Spokane monitorIDs
Spokane <- monitor_subsetBy(N_M, stringr::str_detect(N_M$meta$monitorID,'^53063'))
monitorPlot_timeseries(Spokane, style='gnats')
title('Spokane PM2.5 values, 2015')
monitorPlot_timeseries(Spokane, tlim=c(20150801,20150831), style='aqidots', pch=16)
addAQILegend()
title('Spokane PM2.5 values, August 2015')
monitorPlot_timeseries(Spokane, tlim=c(20150821,20150828), shadedNight=TRUE, style='gnats')
abline(h=AQI$breaks_24, col=AQI$colors, lwd=2)
addAQILegend()
title('Spokane PM2.5 values, August 2015')
# }

Run the code above in your browser using DataLab