Displays an interactive plot of a DTSg
object. This method requires
dygraphs and RColorBrewer to be installed. Its main purpose is
not to make pretty plots, but rather to offer a possibility to interactively
explore time series data. The title of the plot and the label of its primary
axis are automatically generated from the object's metadata (fields). See
DTSg
for further information.
# S3 method for DTSg
plot(
x,
from = first(self$values(reference = TRUE)[[".dateTime"]]),
to = last(self$values(reference = TRUE)[[".dateTime"]]),
cols = self$cols(class = "numeric"),
secAxisCols = NULL,
secAxisLabel = "",
...
)
A DTSg
object (S3 method only).
A POSIXct
timestamp in the same time zone as the time series
or a character string coercible to one. The data is plotted from this
timestamp on.
A POSIXct
timestamp in the same time zone as the time series or
a character string coercible to one. The data is plotted up to this
timestamp.
A character vector specifying the columns whose values shall be
plotted. Another possibility is a character string containing either comma
separated column names, for example, "x,y,z"
, or the start and end column
separated by a colon, for example, "x:z"
.
An optional character vector specifying the columns whose
values shall be plotted on a secondary axis. Another possibility is a
character string containing either comma separated column names, for
example, "x,y,z"
, or the start and end column separated by a colon, for
example, "x:z"
. Must be a subset of cols
.
A character string specifying the label of the optional secondary axis.
Not used (S3 method only).
Returns a DTSg
object.
# new DTSg object
x <- DTSg$new(values = flow)
# plot data
if (requireNamespace("dygraphs", quietly = TRUE) &&
requireNamespace("RColorBrewer", quietly = TRUE)) {
## R6 method
x$plot()
## S3 method
plot(x = x)
}