strs_surf: Plot probability surface for likelihood of stress

View source: R/strs_surf.R

strs_surfR Documentation

Plot probability surface for likelihood of stress

Description

Plot probability surface for likelihood of habitat or water quality stress

Usage

strs_surf(xvar, yvar, mod = c("hab_mod", "wq_mod"), mod_in = NULL,
  title = TRUE, lenv = 200, opt_vrs = NULL, low = "#2c7bb6",
  mid = "#ffffbf", high = "#d7191c")

Arguments

xvar

chr string of variable for x-axis

yvar

chr string of variable for y-axis

mod

chr string of habitat or water quality model to use, must be either 'hab_mod' or 'wq_mod'

mod_in

chr string of model to use (GLM), appropriate for mod

title

logical indicating if title is shown above plot

lenv

numeric indicating resolution of probability surface

opt_vrs

names list with optional constant values for variables not specified by xvar and yvar

low

chr string for color on low end of palette

mid

chr string for color at mid range of palette

high

chr string for color at high end of palette

Details

Plots a smooth surface of the likelihood of either habitat or water quality stress for selected ranges of two variables. The remaining variables are held constant at average values for those in the calibration dataset unless manually set with user input.

Value

A ggplot object

Examples


# water quality stress
opt_vrs <- list(
  TN = 2.22,
  TP = 0.156,
  Cond = 100
)

strs_surf(xvar = 'TN', yvar = 'TP', mod = 'wq_mod', mod_in = 'wqglm', opt_vrs = opt_vrs)

# habitat stress
opt_vrs <- list(
  hy = 100,
  PCT_SAFN = 1, 
  XCMG = 1
)

# hab
strs_surf(xvar = 'hy', yvar = 'PCT_SAFN', mod  = 'hab_mod', mod_in = 'habglm', opt_vrs = opt_vrs)


SCCWRP/SQI documentation built on April 10, 2022, 1:15 p.m.