Generate a histogram of a minimum runoff month for two periods: before and after the change year set by year parameter.
Usage
gr_plot_minmonth(
df,
year = NULL,
exclude = NULL,
tests = NULL,
pagebreak = FALSE,
print = TRUE
)Arguments
- df
data.frameof hydrograph and meteorological variables as produced bygr_summarize().- year
Integer. Change year value to separate two periods.
- exclude
Integer vector of years to be excluded from plotting.
- tests
Tests list for the same variables (generated by
gr_test_vars()function)- pagebreak
Logical. Whether to break page between plots (needed for reporting). Defaults to
FALSE.Boolean. Print plot? Defaults to
TRUE. UseFALSEif you want to tweak the plot aesthetics before plotting.
Value
list of two ggplot2 objects, representing the histogram of a minimum runoff month for two periods: before and after the change year
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'))
#> grwat: data frame is correct
#> grwat: parameters list and types are OK
# summarize from 1965 to 1990
vars = gr_summarize(sep, 1965, 1990)
#> Warning: There were 4 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `Dspstart = min(.data$Date[which(.data$Qspri > 0)])`.
#> ℹ In group 10: `Year1 = 1974`.
#> Caused by warning in `min.default()`:
#> ! no non-missing arguments to min; returning Inf
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 3 remaining warnings.
# plot minimum runoff month for two periods divided by Pettitt test
gr_plot_minmonth(vars, tests = gr_test_vars(vars))
# plot minimum runoff month for two periods divided by fixed year
gr_plot_minmonth(vars, year = 1978)