basinWaterBalancePlot: Stacked plot of yearly water balance variables

View source: R/basinWaterBalancePlot.R

basinWaterBalancePlotR Documentation

Stacked plot of yearly water balance variables

Description

Creates a stacked bar plot of all water balance components computed for a basin. Basin inputs are plotted as positive values, outputs are plotted as negative.

Usage

basinWaterBalancePlot(yearlyWater, negCols = "")

Arguments

yearlyWater

Required. A data frame of water balance components. The first column must be the year. Note that this function does not allow you to select columns - all columns will be plotted.

negCols

Optional. Columns to be plotted as negative values. If not specified (the default) the columns will be guessed from their names.

Value

If successful returns a ggplot2 object showing stacked bars of the water balance components for each year. If unsuccessful returns FALSE.

Author(s)

Kevin Shook. Idea from http://www.r-bloggers.com/improved-net-stacked-distribution-graphs-via-ggplot2-trickery/

Examples

## Not run: 
# get daily water balance from CRHM output
daily <- simpleDailyWater(Bol84, prjFile = 'Bologna1984_02.prj',
basinMean = TRUE, summarize = TRUE)

# get yearly values
daily.datetime <- dateToDatetime(daily, timezone='Etc/GMT+7')
yearly <- aggDataframe(daily.datetime, period='hydro', funs='sum')

# plot
p <- basinWaterBalancePlot(yearly)

## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.