gr_plot_vars: Plot interannual hydrograph variable changes

View source: R/plot.R

gr_plot_varsR Documentation

Plot interannual hydrograph variable changes

Description

This function plots the hydrograph separation variables produced by gr_summarize(). Different background fill colors and line types are used to differentiate seasons and variable types.

Usage

gr_plot_vars(
  df,
  ...,
  tests = NULL,
  exclude = NULL,
  smooth = TRUE,
  layout = as.matrix(1),
  pagebreak = FALSE,
  print = TRUE
)

Arguments

df

data.frame of hydrograph and meteorological variables produced by gr_summarize().

...

Quoted sequence of variable names.

tests

list of tests for the same variables (generated by gr_test_vars() function). If tests are specified, then they are added to the plot.

exclude

Integer vector of years to be excluded from plotting.

smooth

Logical. If TRUE then local smoothing regression is plotted. Defaults to TRUE.

layout

matrix that encodes the order of plotting.

pagebreak

Logical. Whether to break page between plots (gr_report()). Defaults to FALSE.

print

Boolean. Print plot? Defaults to TRUE. Use FALSE if you want to tweak the plot aesthetics before plotting.

Value

list of ggplot2 objects, one for each variable, representing its interannual 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 one selected variable
gr_plot_vars(vars, Qygr) 

# plot two variables sequentially
gr_plot_vars(vars, D10w1, Wsprngr)

# four variables in matrix layout with tests calculated on the fly
gr_plot_vars(vars, Qspmax, Qygr, D10w1, Wsprngr,
             layout = matrix(1:4, nrow = 2, byrow = TRUE),
             tests = TRUE) 

tsamsonov/grwat documentation built on Feb. 10, 2024, 5:55 p.m.