Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/seasonal_barplot.R
Cumulative bar plot over a historic range
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 
| 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  | 
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.
A ggplot object
Julie Padilla
ggplot, assign_season, y_labeler
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.