Learn R Programming

SWMPrExtension (version 0.3.12)

seasonal_dot: Seasonal Dot Plot

Description

Plot average/min/max seasonal values faceted by season

Usage

seasonal_dot(swmpr_in, ...)

# S3 method for swmpr seasonal_dot(swmpr_in, param = NULL, lm_trend = FALSE, lm_lab = FALSE, log_trans = FALSE, converted = FALSE, plot_title = FALSE, plot = TRUE, ...)

Arguments

swmpr_in

input swmpr object

...

additional arguments passed to other methods. See assign_season

param

chr string of variable to plot

lm_trend

logical, add linear trend line?

lm_lab

logical, add significance label? Statistically significant results will appear in bold.

log_trans

logical, should y-axis be log? Defaults to FALSE

converted

logical, were the units converted from the original units used by CDMO? Defaults to FALSE. See y_labeler for details.

plot_title

logical, should the station name be included as the plot title? Defaults to FALSE

plot

logical, should a plot be returned? Defaults to TRUE

Value

Returns a ggplot object

Details

This function summarizes minimum, mean, and maximum values calculated on a seasonal basis to allow for easier intra-season comparisons over time.

lm_trend = T adds a linear regression to the plot, and lm_lab = T will add p-values from the linear regression to the plot. If the p-values are significant (p < 0.05) then the text will appear in bold. lm_lab text is color coded to match with the corresponding dots.

See Also

ggplot, assign_season, y_labeler

Examples

Run this code
# NOT RUN {
dat_wq <- elksmwq
#dat_wq <- subset(dat_wq, subset = c('2010-01-01 0:00', '2017-01-01 0:00'))
dat_wq <- qaqc(dat_wq, qaqc_keep = c(0, 3, 5))

x <-
  seasonal_dot(dat_wq, param = 'do_mgl'
               , lm_trend = TRUE
               , lm_lab = TRUE
               , plot_title = TRUE)

# }
# NOT RUN {
x <-
  seasonal_dot(dat_wq, param = 'do_mgl'
               , lm_trend = FALSE
               , lm_lab = FALSE
               , plot_title = TRUE)

x <-
  seasonal_dot(dat_wq, param = 'do_mgl'
               , lm_trend = TRUE
               , lm_lab = FALSE
               , plot_title = TRUE)


dat_nut <- elknmnut
dat_nut <- subset(dat_nut, subset = c('2007-01-01 0:00', '2017-01-01 0:00'))
dat_nut <- qaqc(dat_nut, qaqc_keep = c(0, 3, 5))

x <-
  seasonal_dot(dat_nut
               , param = 'chla_n'
               , 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_start = 'Spring'
               , lm_trend = FALSE
               , lm_lab = FALSE
               , plot_title = TRUE)

x <-
  seasonal_dot(dat_nut, param = 'chla_n'
               , lm_trend = TRUE
               , lm_lab = FALSE
               , plot_title = TRUE)

x <-
  seasonal_dot(dat_nut, param = 'chla_n'
               , lm_trend = TRUE
               , lm_lab = TRUE
               , plot_title = TRUE)
# }

Run the code above in your browser using DataLab