plot.uts: Plot a uts

Description Usage Arguments Examples

View source: R/plot.R

Description

A convenience wrapper around plot.default with several sensible default arguments.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'uts'
plot(
  x,
  max_dt = ddays(Inf),
  type = "l",
  col = "blue",
  xlab = "",
  ylab = "",
  plot.new = TRUE,
  ...
)

Arguments

x

a "uts" object with numeric or logical observation values.

max_dt

a non-negative duration object. Consecutive observations that are more than this amount apart in time, are not connected by a line in the graph.

type

what type of plot should be drawn, see plot.default. type="b" is helpful for highlighting individual observations.

col

the colors for lines and points. See plot.default.

xlab

a label for the x axis.

ylab

a label for the y axis.

plot.new

logical If TRUE, a new plot is created from scratch. If FALSE, the plop is superimposed on the currently open plot.

...

other graphical parameters passed to plot.default.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
plot(ex_uts())
plot(ex_uts(), max_dt=dhours(12), type="b")   # don't connect points more than 12 hours apart
plot(ex_uts(), max_dt=dhours(2), type="b")

# Plot time series with NAs
tmp <- ex_uts()
tmp$values[2] <- NA
plot(tmp, type="o")         # isolated points are plotted as circles
plot(na.omit(tmp), type="b")

# Use custom date formatting for x axis
# -) the "format" argument is passed down to axis.POSIXct()
# -) this example produces several harmless warning messages, because other
#    functions that are part of the call chain have no "format" argument
plot(ex_uts(), format="%a %I%p")

# Plot two time series on top of each other
plot(ex_uts())
plot(ex_uts() + 0.1, plot.new=FALSE, col="red")

andreas50/uts documentation built on April 8, 2021, 10:03 a.m.