Skip to contents

Produces bar charts, forest plots, and quantile summaries from a climasus_af object returned by sus_mod_af(). All visualisation types follow standard environmental epidemiology burden-of-disease reporting.

Usage

sus_mod_plot_af(
  fit,
  type = c("bar", "forest", "quantile"),
  output_type = c("plot", "table", "all"),
  interactive = FALSE,
  base_size = 12L,
  save_plot = NULL,
  lang = c("pt", "en", "es"),
  verbose = FALSE
)

Arguments

fit

A climasus_af object produced by sus_mod_af().

type

Character. Plot type: "bar" (default), "forest", or "quantile".

output_type

Character. "plot" (default), "table", or "all" (named list $plot, $table, $data).

interactive

Logical. TRUE converts the ggplot2 output to an interactive plotly widget. Default FALSE.

base_size

Numeric. ggplot2 base font size. Default 12.

save_plot

Character or NULL. File path to save the plot (PNG/PDF for static; HTML for interactive).

lang

Character. Language for labels: "pt" (default), "en", "es".

verbose

Logical. Print progress messages. Default FALSE.

Value

Depending on output_type:

  • "plot" -> a ggplot or plotly object.

  • "table" -> a tibble of the plotted data.

  • "all" -> a named list: $plot, $table, $data.

Plot types (type)

typeDescription
"bar"Grouped bar chart of AF% with CI by component (heat/cold/total)
"forest"Horizontal forest plot of AN +/- CI by component
"quantile"Bar chart of AF% across exposure quantile bands (requires $by_quantile)

Examples

if (FALSE) { # \dontrun{
fit <- sus_mod_dlnm(df_dl, outcome_col = "n_obitos")
af  <- sus_mod_af(fit)

sus_mod_plot_af(af, type = "bar",      lang = "pt")
sus_mod_plot_af(af, type = "forest",   lang = "en")
sus_mod_plot_af(af, type = "quantile", lang = "es")
out <- sus_mod_plot_af(af, output_type = "all")
out$table
} # }