Skip to contents

Plotting interface and S3 plot() method for cba_uncertainty objects generated by perform_sa().

Usage

plot_sa(
  x,
  type = c("both", "uncertainty", "sobol", "triplet"),
  indicator = c("npv", "benefit"),
  sobol_order = c("both", "total", "first"),
  lang = "en",
  dir_output = tempdir(),
  device = c("active", "pdf", "png", "jpg", "jpeg", "svg"),
  ...
)

# S3 method for class 'cba_uncertainty'
plot(x, ...)

Arguments

x

An object of class cba_uncertainty (as returned by perform_sa()), or a compatible list or data frame.

type

Character scalar specifying the plot layout: "both" (default), "uncertainty", "sobol", or "triplet".

indicator

Character scalar specifying the target indicator: "npv" (default) or "benefit".

sobol_order

Character scalar specifying which Sobol indices to display: "both" (default), "total", or "first".

lang

Character scalar, language for labels: "en" (default), with 11 ISO 639-1 languages supported.

dir_output

Character scalar, destination directory for exported files (defaults to tempdir()). Ignored when device = "active".

device

Character scalar specifying the graphics device: "active" (default, render to active device), "pdf", "png", "jpg", "jpeg", or "svg".

...

Additional graphical arguments passed to underlying plotting functions.

Value

An invisible character scalar giving the path of the generated file when device != "active", or invisible NULL when device = "active".

Details

Dispatches graphical representations according to type:

When device != "active", the graphic is rendered into a file in dir_output whose name is automatically formatted as <case>-<project>-<graphic>-<lang>.<device>.

Author

Frédéric Grelot, frederic.grelot.1994_cran@m4x.org

Examples

case = import_case(
    system.file("extdata", "case", "simple.ods", package = "floodam.cba")
)
#> import Case from /tmp/RtmpvMoJJK/temp_libpath2b69f6f14b9e9/floodam.cba/extdata/case/simple.ods
#>  ... done
res = perform_sa(case, n = 50, verbose = FALSE)
plot(res, type = "uncertainty")

plot(res, type = "sobol")