plot_seasonality_box: plot_seasonality_box

View source: R/plot_seasonality_box.R

plot_seasonality_boxR Documentation

plot_seasonality_box

Description

This function produces a Tukey style box plot of seven day average daily maximum river temperatures grouped by the first and second half of each month for one or more monitoring locations. The month is split on the 15th with the first group including all results measured on the 1st through the 14th day and the second group including all results measured on the 15th through the end of the month. These plots are intended to be placed in the seasonal variation and critical period section of temperature TMDLs. The temperature criteria line is drawn based on the fish use designation for each station. A yellow box can be included to represent times of impairment.

Usage

plot_seasonality_box(
  df,
  station_col = "MLocID",
  date_col = "SampleStartDate",
  result_col = "Result_Numeric",
  temp_criteria_col = "Temp_Criteria",
  spawn_start_col = "SpawnStart",
  spawn_end_col = "SpawnEnd",
  critical_plot = TRUE,
  critical_start = "guess",
  critical_end = "guess",
  facet = FALSE,
  facet_col = 2,
  y_axis_max = 28,
  y_axis_int = 5,
  y_label = "7DADM Temperature (deg-C)"
)

Arguments

df

Data frame of data to be graphed

station_col

Name of column containing station ID, name ,or grouping label. This is the value used for facet. Default is "MLocID".

date_col

Name of the datetime column. Format as character in "yyyy-mm-dd". Defaults is "SampleStartDate".

result_col

Name of column containing result information. Default is 'Result_Numeric'.

temp_criteria_col

Name of column containing the numeric non spawning temperature criteria. Defaults is "Temp_Criteria".

spawn_start_col

Name of column containing the spawning start date. Format as character in "mm-dd". Defaults is "SpawnStart".

spawn_end_col

Name of column containing the spawning end date. Format as character in "mm-dd". Defaults is "SpawnEnd".

critical_plot

Logical if the plot should highlight the critical period. The critical period shown on the plot is the same for all data in df. If different periods are desired the data will need to be separated and sent to this function individually.

critical_start

Start of the critical period. Format as character in "mm-dd" or "guess". Guess rounds the date down by half month periods based on the earliest date temperatures exceed the temperature criteria in any given year. Default is "guess".

critical_end

End of the critical period. Format as character in "mm-dd" or "guess. Guess rounds the date up by half month periods based on the latest date temperatures exceed the temperature criteria in a given year. Default is "guess".

facet

Logical if the plot should be a facet wrap using the station_col name to facet by. Default is FALSE.

y_axis_max

Maximum value for the y-axis. Default is 28.

y_axis_int

Interval between y-axis labels. Default is 5.

y_label

Label for the y-axis. Default is '7DADM Temperature (deg-C)'.

facet_cols

Number of columns in the facet wrap. Ignored if facet = FALSE. Default is 2.

Value

plot of all 7DADM data, with criteria and critical period Plot

Examples

 ## Not run: 

 library(AWQMSdata)
 library(odeqtmdlplots)

 df.raw <- AWQMS_Data(station = '14034470', char = "temperature, water",
                    stat_base = "7DADM", crit_codes = TRUE)
 df <- df.raw %>%
 left_join(AWQMSdata::Temp_crit, by = "FishCode") %>%
 left_join(AWQMSdata::LU_spawn, by = "SpawnCode") %>%
 mutate(Result_Numeric = if_else(Result_Unit == "deg F",
                                  (Result_Numeric - 32) * 5/9,
                                  Result_Numeric)) %>%
 select(MLocID, StationDes, Temp_Criteria, SpawnStart, SpawnEnd, Result_Numeric)

 plot_seasonality_box(df = df)


## End(Not run)



TravisPritchardODEQ/TMDLMrkdwn documentation built on Jan. 17, 2024, 5:32 a.m.