seasonal_dot: Seasonal Dot Plot

View source: R/seasonal_dot.R

seasonal_dotR Documentation

Seasonal Dot Plot

Description

Plot average/min/max seasonal values faceted by season

Usage

seasonal_dot(swmpr_in, ...)

## S3 method for class 'swmpr'
seasonal_dot(
  swmpr_in,
  param = NULL,
  lm_trend = FALSE,
  lm_lab = FALSE,
  free_y = 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.

free_y

logical, should the y-axis be free? Defaults to FALSE. If FALSE, defaults to zero, unless negative values are present. If TRUE, y-axis limits are selected by ggplot

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

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 = TRUE adds a linear regression to the plot, and lm_lab = TRUE 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.

Value

Returns a ggplot object

Author(s)

Julie Padilla, Dave Eslinger

See Also

ggplot, assign_season, y_labeler

Examples

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)


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

z <-
  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))

x1 <-
  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)

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

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


SWMPrExtension documentation built on April 21, 2023, 1:14 a.m.