seasonal_barplot {SWMPrExtension} | R Documentation |
Cumulative Bar Plot
Description
Cumulative bar plot over a historic range
Usage
seasonal_barplot(swmpr_in, ...)
## S3 method for class 'swmpr'
seasonal_barplot(
swmpr_in,
param = NULL,
hist_rng = NULL,
log_trans = FALSE,
converted = FALSE,
hist_avg = TRUE,
bar_position = "stack",
season_facet = FALSE,
plot_title = FALSE,
plot = TRUE,
...
)
Arguments
swmpr_in |
input swmpr object |
... |
additional arguments passed to other methods. See |
param |
chr string of variable to plot |
hist_rng |
numeric vector, if historic range is not specified then the min/max values of the data set will be used. |
log_trans |
logical, should y-axis be log? Defaults to |
converted |
logical, were the units converted from the original units used by CDMO? Defaults to |
hist_avg |
logical, should a historical average be included? Defaults to |
bar_position |
chr string, options available are |
season_facet |
logical, should plot be faceted by season? Defaults to |
plot_title |
logical, should the station name be included as the plot title? Defaults to |
plot |
logical, should a plot be returned? Defaults to |
Details
This function uses barplots to summarize parameters that are best viewed on a cumulative basis (e.g., precipitation). Data are aggregated on a seasonal and annual basis.
There are two ways to make interannual comparisons: on an aggregate basis and on a seasonal basis. If the argument season_facet = FALSE
then parameter totals from each season will be added together to compose one, multi-color bar.If season_facet = TRUE
then parameter totals from each season separated into multiple plots for easier intra-season comparison across years.
Value
A ggplot
object
Author(s)
Julie Padilla
See Also
ggplot
, assign_season
, y_labeler
Examples
data(apaebmet)
dat <- qaqc(apaebmet, qaqc_keep = c('0', '3', '5'))
x <- seasonal_barplot(dat, param = 'totprcp'
, season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12))
, season_names = c('Winter', 'Spring', 'Summer', 'Fall')
, hist_avg = TRUE
, converted = FALSE)
# return a table instead of a figure
y <- seasonal_barplot(dat, param = 'totprcp'
, season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12))
, season_names = c('Winter', 'Spring', 'Summer', 'Fall')
, converted = FALSE
, plot = FALSE)
## divide plot into seasonal facets
z <- seasonal_barplot(dat, param = 'totprcp'
, season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12))
, season_names = c('Winter', 'Spring', 'Summer', 'Fall')
, season_facet = TRUE
, hist_avg = TRUE
, converted = FALSE)
## convert from mm to in
dat$totprcp <- dat$totprcp / 25.4
x1 <- seasonal_barplot(dat, param = 'totprcp'
, season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12))
, season_names = c('Winter', 'Spring', 'Summer', 'Fall')
, hist_avg = TRUE
, converted = TRUE)