plot_seasonality: plot_seasonality

View source: R/plot_seasonality.R

plot_seasonalityR Documentation

plot_seasonality

Description

This function produces a plot of seven day average daily maximum river temperatures for one or more monitoring locations grouped by year. 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 of fish use station designation. A yellow boxes can be included to represent times of impairment.

Usage

plot_seasonality(
  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",
  highlight_year = NULL,
  facet = FALSE,
  facet_col = 2,
  show_legend = TRUE,
  y_axis_max = 28,
  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 seperated and sent to this fuction 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".

highlight_year

Optional year to highlight on plot. Default is NULL.

facet

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

show_legend

Logical if the legend should be included on the plot. default is TRUE. the highlight year is not included on the legend.

y_axis_max

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

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(df = df)


## End(Not run)



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