plot_timeseries()
plots a time series comparing simulated data with observed data.
Usage
plot_timeseries(
sim,
obs = NULL,
run_sel = NULL,
run_ids = NULL,
plot_bands = TRUE,
sim_pointshape = 1,
obs_pointshape = 1,
sim_linetype = "solid",
obs_linetype = "dotted",
run_sel_color = "#A50F15",
run_ids_color = NULL,
obs_color = "black",
band_color = "#CB181D",
band_alpha = 0.2,
run_sel_label = "Simulation",
obs_label = "Observation",
band_label = "Simulated range",
x_label = "Date",
y_label = expression(Discharge ~ (m^3 ~ s^{
-1
})),
legend_pos = c(1, 0.99, 0.99),
split_years = NULL,
free_y = FALSE
)
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_sel
(optional) Integer value or name of simulation run which should be plotted as 'selected' run. Default
run_sel = NULL
no run is plotted as 'selected' run. In this caserun_ids
must be selected for plotting.- run_ids
(optional) Integer vector or character vector of run IDs or run names to plot. Default
run_ids = NULL
. In this case only the 'seleced' simulation run fromrun_sel
is plotted. Ifplot_bands = TRUE
the selectedrun_ids
are used to calculate and plot the upper and lower boundaries of the plotted band. Ifplot_bands = FALSE
a maximum number of 10run_ids
can be selected for plotting.- plot_bands
(optional) If TRUE, upper and lower boundary values are calculated from the selected
run_ids
and a band is plotted for them. If FALSE the individual selected runs fromrun_ids
are plotted. Defaultplot_bands = TRUE
.- sim_pointshape
(optional) Integer value defining the shape of the points to be plotted for the simulated time series of
run_sel
. The value must be a value between 0 and 25. For all other inputs no points will be plotted. Default issim_pointshape = 1
.- obs_pointshape
(optional) Integer value defining the shape of the points to be plotted for the observation time series. The value must be a value between 0 and 25. For all other inputs no points will be plotted. Default is
obs_pointshape = 1
.- sim_linetype
(optional) Type of the line to be plotted for the simulated time series. The linetype must be one of 'blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash
, or 'twodash'. When 'blank' no line will be plotted. Default is
sim_linetype = 'solid'`.- obs_linetype
Type of the line to be plotted for the observation time series. The linetype must be one of 'blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash
, or 'twodash'. When 'blank' no line will be plotted. Default is
obs_linetype = 'dotted'`.- run_sel_color
(optional) Color of the line and points plotted for the simulation time series
run_sel
. Defaultrun_sel_color = '#A50F15'
.- run_ids_color
(optional) Colors of the lines plotted for the simulation time series selected with
run_ids
. The colors are only used whenplot_bands = FALSE
and individual timeseries are plotted. The color vector must be of the same length as the selected runs inrun_ids
. Defaultrun_ids_color = NULL
where a default color pallete is used.- obs_color
(optional) Color of the line and points of the plotted observation time series. Default
obs_color = 'black'
.- band_color
(optional) Color of the band plotted fur the
run_ids
. The color is only used whenplot_bands = TRUE
. Defaultband_color = '#CB181D'
.- band_alpha
(optional) Transparency value of the band plotted fur the
run_ids
. The value is only used whenplot_bands = TRUE
. The value must be set between 0 and 1. Defaultband_alpha = 0.2
.- run_sel_label
(optional) Label which is plotted in the legend to indicate the selected simulation run
run_sel
. Default isrun_sel_label = 'Simulation'
.- obs_label
(optional) Label which is plotted in the legend to indicate the observation time series. Default is
run_obs = 'Observation'
.- band_label
(optional) Label which is plotted in the legend to indicate the simulation band for the
run_ids
. Default isband_label = 'Simulated range'
.- x_label
(optional) x-Axis label. Default is
x_label = 'Date'
.- y_label
(optional) y-Axis label. Default is
x_label = expression(Discharge~(m^3~s^{-1}))
.- legend_pos
(optional) Position of the legend inside of the plot panel.
- split_years
(optional) Integer value which is used to split the time series into time intervals of the length
split_years
to plot those time periods in separate plot panels. This has an advantage for plotting long time series. Defaultsplit_years = NULL
and the entire time series is plotted in one plot panel.- free_y
If
split_years
is defined the y-Axis can be scaled individually for all plot panels iffree_y = TRUE
. Defaultfree_y = FALSE
and all plot panels have the same y plot range.