Skip to contents

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

Usage

plot_selected_sim(
  sim,
  obs = NULL,
  par_name = 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

Object from SWATrunR.

obs

(optional) Dataframe for observed data with columns 'date' and 'value'. Default obs = NULL, only simulation data are available.

par_name

(optional) Name of the parameter set to use. Default par_name = NULL uses the first variable in sim object. For multiple parameter sets, specify the one to use, e.g., par_name = "flo_day" or par_name = "no3_day_conc".

run_ids

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

run_sel

(optional) Character 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) {
plot_selected_sim(sim_flow, obs = obs, run_sel = c(95), run_ids = run_sel_ids,
period = "average monthly", plot_bands = TRUE)
}