plots a stiff diagram
stiff_plot(df, location_id = "location_id", sample_date = "sample_date", param_name = "param_name", analysis_result = "analysis_result", default_unit = "default_unit", magnesium = "Magnesium, dissolved", calcium = "Calcium, dissolved", sodium = "Sodium, dissolved", potassium = "Potassium, dissolved", chloride = "Chloride, total", sulfate = "Sulfate, total", alkalinity = "Alkalinity, total (lab)", total_dissolved_solids = NULL, group_var = "location_id", facet_var = "sample_date", lines = FALSE, cex = 1)
df | data frame of water quality data |
---|---|
location_id | column for sample locations |
sample_date | column for sample date |
param_name | column for constituent names |
analysis_result | column for analysis result |
default_unit | column for units. Assumes all units are in mg/L and
converts usign |
magnesium | name for magnesium |
calcium | name for calcium |
sodium | name for sodium |
potassium | name for potassium |
chloride | name for chloride |
sulfate | name for sulfate |
alkalinity | name for alkalinity |
total_dissolved_solids | name for TDS to scale color of plot. Default is NULL |
group_var | parameter to separate plots by. Default is sample location |
facet_var | parameter to facet the plot by. Default is sample date |
lines | TRUE/FALSE plots lines |
cex | multiplier to scale plot height |
tidy dataframe of water quality data in mg/L is converted to meq/L and then transformed to coordinates for Stiff diagmram.
data(gw_data) gw_data %>% filter(location_id == "MW-1", sample_date < lubridate::ymd("2008-01-01")) %>% stiff_plot()#>#> Error: `scale_id` must not be `NA`gw_data %>% filter(location_id %in% c("MW-1", "MW-2")) %>% stiff_plot(., total_dissolved_solids = "Total Dissolved Solids")#>#> Error: `scale_id` must not be `NA`