gr_plot_periods {grwat} | R Documentation |
Plot long-term hydrograph variable changes
Description
This function generates boxplots of the hydrograph separation variables produced by gr_summarize()
. The data for each variable is divided into two samples: before and after the change year either set by year
parameter or extracted from tests
(statistically estimated). Different background fill colors are used to differentiate seasons types.
Usage
gr_plot_periods(
df,
...,
year = NULL,
exclude = NULL,
tests = NULL,
layout = as.matrix(1),
pagebreak = FALSE,
print = TRUE
)
Arguments
df |
|
... |
Quoted sequence of variable names. |
year |
Integer. Change year value to separate two periods (overridden by tests if it is supplied). |
exclude |
Integer vector of years to be excluded from plotting. |
tests |
Tests list for the same variables (generated by |
layout |
|
pagebreak |
Logical. Whether to break page between plots (needed for reporting). Defaults to |
print |
Boolean. Print plot? Defaults to |
Value
list
of ggplot2
objects, one for each variable, representing its long-term changes
Examples
library(grwat)
data(spas) # example Spas-Zagorye data is included with grwat package
# separate
sep = gr_separate(spas, params = gr_get_params(reg = 'center'))
# summarize from 1965 to 1990
vars = gr_summarize(sep, 1965, 1990)
# plot periods with fixed change year
gr_plot_periods(vars, Qygr, year = 1978)
# plot periods with change year from Pettitt test
gr_plot_periods(vars, Qygr, tests = TRUE)
# calculate test beforehand
tests = gr_test_vars(vars)
gr_plot_periods(vars, Qspmax, tests = tests)
# use matrix layout to plot multiple variables
gr_plot_periods(vars, Qygr, Qspmax, D10w1, Wsprngr,
layout = matrix(1:4, nrow = 2),
tests = tests)