View source: R/function_PlotSimObsRegime.R
PlotSimObsRegime | R Documentation |
A combined plot for annual regimes with box plot elements for observed variables and ribbon elements for simulated variables. Particularly designed for comparisons of sparse observations with high-density model results, e.g. for in-stream nutrients.
PlotSimObsRegime(
x,
sim,
obs,
ts.in = NULL,
ts.out = "month",
start.mon = 1,
add.legend = TRUE,
pos.legend = "topright",
inset = 0,
l.legend = NULL,
log = FALSE,
ylim = NULL,
xlab = NULL,
ylab = NULL,
mar = c(3, 3, 1, 1) + 0.1
)
x |
Data frame, with column-wise equally-spaced time series of HYPE variables. Date-times in
|
sim , obs |
Character string keywords, observed and simulated HYPE variable IDs to plot. Not case-sensitive, but must exist in |
ts.in |
Character string, timestep of |
ts.out |
Character string, aggregation timestep for simulation results, defaults to |
start.mon |
Integer between 1 and 12, starting month of the hydrological year, used to order the output. |
add.legend |
Logical. If |
pos.legend |
Character string keyword for legend positioning. See Details in |
inset |
Integer, legend inset as fraction of plot region, one or two values for x and y. See |
l.legend |
Character vector of length 2 containing variable labels for legend, first for |
log |
Logical, if |
ylim |
Numeric vector of length two, giving y-axis limits. Defaults to min-max range of all plotted data. |
xlab |
Character string or |
ylab |
Character or |
mar |
Numeric vector of length 4, margin specification passed to |
PlotSimObsRegime
combines ribbons and box plot elements. Box plot elements are composed as defaults from boxplot
,
i.e. boxes with 25\
extreme values as points. Observation counts per month over the observation period are printed above the x-axis.
Aggregation time length of the simulated variable can be chosen in argument ts.out
, resulting in more or less smoothed ribbons.
For the observed variable, the aggregation is fixed to months, in order to aggregate enough values for each box plot element.
PlotSimObsRegime
returns a plot to the currently active plot device, and invisibly a list
object containing three
elements with the plotted data and variable IDs.
Element obs
contains a list as returned by AnnualRegime
. Element obs
contains a list with two elements, a
vector refdate
with x positions of box plots elements, and a list reg.obs
with observations for the monthly box plot elements.
Element variable
contains a named vector with HYPE variable IDs for observations and simulations. sim
and obs
returned
empty if corresponding function argument was NULL
.
PlotAnnualRegime
for a more generic annual regime plot, AnnualRegime
to compute annual regimes only.
# Plot observed and simulated discharge
te <- ReadBasinOutput(filename = system.file("demo_model",
"results", "0003587.txt", package = "HYPEtools"))
PlotSimObsRegime(x = te, sim = "cout", obs = "rout", start.mon = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.