
Last chance! 50% off unlimited learning
Sale ends in
Plot multiple SWMP time series on the same y-axis, aka overplotting
overplot(dat_in, ...)# S3 method for swmpr
overplot(
dat_in,
select = NULL,
subset = NULL,
operator = NULL,
ylabs = NULL,
xlab = NULL,
cols = NULL,
lty = NULL,
lwd = NULL,
pch = NULL,
type = NULL,
...
)
# S3 method for default
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,
pch = NULL,
type = NULL,
...
)
An R plot created using base graphics
input data object
additional arguments passed to plot
chr string of variable(s) to plot, passed to subset
. This is a required argument for the default method.
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
.
chr string specifiying binary operator (e.g., '>', '<=') if subset is one date value, passed to subset
chr string of labels for y-axes, default taken from select
argument
chr string of label for x-axis
chr string of colors to use for lines
numeric indicating line types, one value for all or values for each parameter
numeric indicating line widths, one value for all or values for each parameter, used as cex
for point size if type = 'p'
numeric for point type of points are used
character string indicating 'p'
or 'l'
for points or lines, as a single value for all parameters or a combined vector equal in length to the number of parameters
chr string of the name for the datetimestamp column, not required for swmpr
objects
numeric of relative location of legend, passed to legend
numeric of scale factor for legend, passed to legend
x location of legend, passed to legend
y location of legend, passed to legend
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
.
## 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)
if (FALSE) {
## change the type argument if plotting discrete and continuous data
swmp1 <- apacpnut
swmp2 <- apaebmet
dat <- comb(swmp1, swmp2, timestep = 120, method = 'union')
overplot(dat, select = c('chla_n', 'atemp'), subset = c('2012-01-01 0:0', '2013-01-01 0:0'),
type = c('p', 'l'))
}
Run the code above in your browser using DataLab