Learn R Programming

SWMPr (version 2.1.5)

overplot: Plot multiple SWMP time series on the same y-axis

Description

Plot multiple SWMP time series on the same y-axis, aka overplotting

Usage

overplot(dat_in, ...)
"overplot"(dat_in, select = NULL, subset = NULL, operator = NULL, ylabs = NULL, xlab = NULL, cols = NULL, lty = NULL, lwd = NULL, ...)
"overplot"(dat_in, date_var, select = NULL, ylabs = NULL, xlab = NULL, cols = NULL, lty = NULL, lwd = NULL, inset = -0.15, cex = 1, xloc = "top", yloc = NULL, ...)

Arguments

dat_in
input data object
...
additional arguments passed to plot
select
chr string of variable(s) to plot, passed to subset. This is a required argument for the default method.
subset
chr string of form 'YYYY-mm-dd HH:MM' to subset a date range. Input can be one (requires operator or two values (a range). Passed to subset.
operator
chr string specifiying binary operator (e.g., '>', '<=') if="" subset="" is="" one="" date="" value,="" passed="" to="" subset
ylabs
chr string of labels for y-axes, default taken from select argument
xlab
chr string of label for x-axis
cols
chr string of colors to use for lines
lty
numeric indicating line types, one value for all or values for each parameter
lwd
numeric indicating line widths, one value for all or values for each parameter
date_var
chr string of the name for the datetimestamp column, not required for swmpr objects
inset
numeric of relative location of legend, passed to legend
cex
numeric of scale factor for legend, passed to legend
xloc
x location of legend, passed to legend
yloc
y location of legend, passed to legend

Value

An R plot created using base graphics

Details

One to many SWMP parameters can be plotted on the same y-axis to facilitate visual comparison. This is commonly known as overplotting. The building blocks of this function include plot, legend, axis, and mtext.

See Also

subset

Examples

Run this code
## import data
data(apacpwq)
dat <- qaqc(apacpwq)

## plot
overplot(dat)

## a truly heinous plot
overplot(dat, select = c('depth', 'do_mgl', 'ph', 'turb'), 
 subset = c('2013-01-01 0:0', '2013-02-01 0:0'), lwd = 2)

Run the code above in your browser using DataLab