plot_state_vars: Plot state variables

Description Usage Arguments Value Examples

View source: R/figures_manuscript.R

Description

Plot state variables

Usage

1
2
3
4
5
6
7
8
9
plot_state_vars(
  time_series = ts_data,
  bloom_fert_df = bloom_fert_dates,
  var_rename_vec = c(`Chl-a (ug/L)` = "Manual_Chl", `BGA (cells/mL)` = "BGA_HYLB",
    `D.O. sat. (%)` = "DO_Sat", pH = "pH"),
  lakes_rename_vec = c(Reference = "L", Experimental = "R"),
  lake_colors = c(Experimental = "firebrick3", Reference = "royalblue3"),
  legend_location = c(0.13, 0.9)
)

Arguments

time_series

data frame containing time series of state variables, , see ts_data for default and formatting

bloom_fert_df

data frame of fertilization start and end and bloom start dates, see bloom_fert_dates for default and formatting

var_rename_vec

named vector, used to change variable names displayed in plot, format is c("new name" = "original name")

lakes_rename_vec

named vector, used to change lake names displayed in plot, format is c("new name" = "original name")

lake_colors

named vector, used to specify colors for each lake, format is c("Lake" = "color")

legend_location

numerical vector of length 2, has c(x, y) position for placing legend on plot

Value

ggplot object plotting the time series

Examples

1
2
3
4
5
6
7
8
# all data:
plot_state_vars()

# just latest experiment
plot_state_vars(
  time_series = ts_data %>% dplyr::filter(Year >= 2018),
  bloom_fert_df = bloom_fert_dates %>% dplyr::filter(Lake == "R" & Year >= 2018)
)

cbuelo/tvsews documentation built on Jan. 21, 2022, 1:31 a.m.