Skip to contents

This function plots interactive time series comparing simulated data with observed data.

Usage

view_timeseries(
  sim,
  obs = NULL,
  run_ids = NULL,
  run_sel = NULL,
  plot_bands = TRUE,
  period = NULL,
  fn_summarize = "mean",
  x_label = "Date",
  y_label = "Discharge (m<sup>3</sup> s<sup>-1</sup>)"
)

Arguments

sim

Data frame with one date column and one or many columns with values of the simulated variable.

obs

(optional) Data frame with one date and one value column. Default obs = NULL, only simulations are plotted.

run_ids

(optional) Integer vector of run IDs to plot. Default run_ids = NULL requires input of run_sel.

run_sel

(optional) Integer vector of run IDs to emphasize in the plot. Default run_sel = NULL requires input of run_ids.

plot_bands

(optional) Logical. If TRUE, includes lower and upper bands of results. Default plot_bands = TRUE.

period

(optional) Character defining the time step for aggregation. Options include "day", "week", "month", "year", etc. Use "average monthly" for multi-annual monthly values. Default period = NULL provides no aggregation. See lubridate::floor_date for details.

fn_summarize

Function to summarize time intervals. Default fn_summarize ="mean", other examples are "median", "sum". See dplyr::summarise for details.

x_label

(optional) Character for x axis label. Default x_label = "Date".

y_label

(optional) Character for y axis label. Default y_label = "Discharge (m³/s)".

Value

Interactive plot of simulated and observed data.

Examples

if (FALSE) {
view_timeseries(sim_flow, obs = obs, run_ids = run_sel_ids, run_sel = c(95),
plot_bands = TRUE, period = "average monthly")
}