plot_ts {evsim}R Documentation

Interactive plot for time-series tibbles

Description

First column of the df tibble must be a datetime or date variable. The rest of columns must be numeric of the same units. This functions makes use of dygraphs package to generate an HTML Dygraphs plot.

Usage

plot_ts(df, title = NULL, xlab = NULL, ylab = NULL, legend_width = 250, ...)

Arguments

df

data.frame or tibble, first column of name datetime being of class datetime and rest of columns being numeric

title

character, title of the plot (accepts HTML code)

xlab

character, X axis label (accepts HTML code)

ylab

character, Y axis label (accepts HTML code)

legend_width

integer, width (in pixels) of the div which shows the legend.

...

extra arguments to pass to dygraphs::dyOptions function.

Value

dygraph

Examples

suppressMessages(library(lubridate))
suppressMessages(library(dplyr))

# Get demand with the complete datetime sequence from the sessions
sessions <- head(evsim::california_ev_sessions, 100)
demand <- get_demand(
  sessions,
  by = "Session",
  resolution = 60,
  align_time = TRUE
)
demand %>% plot_ts()


[Package evsim version 1.5.0 Index]