Skip to contents

Produces radar (spider), matrix (2x2 SWOT board), and bar charts from a climasus_swot object returned by sus_mod_swot().

Usage

sus_mod_plot_swot(
  x,
  type = c("radar", "matrix", "bar"),
  output_type = c("plot", "table", "all"),
  interactive = FALSE,
  entities = NULL,
  top_n = 3L,
  base_size = 12L,
  save_plot = NULL,
  lang = c("pt", "en", "es"),
  verbose = FALSE
)

Arguments

x

A climasus_swot object from sus_mod_swot().

type

Character. Plot type: "radar" (default), "matrix", or "bar".

output_type

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

interactive

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

entities

Character vector or NULL. Subset of entity names to plot. NULL (default) plots all entities. For type = "matrix", only the first entity in the selection is shown.

top_n

Integer. For type = "matrix", maximum number of indicator bullets to display per quadrant. Default 3L.

base_size

Numeric. ggplot2 base font size. Default 12.

save_plot

Character or NULL. File path to save the plot (PNG/PDF).

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.

Plot types (type)

typeDescription
"radar"Spider/radar chart of the four quadrant scores (0-100) per entity
"matrix"Classic 2x2 SWOT board: score, category label, and top indicators for each quadrant. Best for a single entity.
"bar"Grouped horizontal bars comparing all four quadrant scores per entity

Examples

if (FALSE) { # \dontrun{
swot <- sus_mod_swot(vulnerability = vi, af = af_res, lang = "pt")

sus_mod_plot_swot(swot, type = "matrix", lang = "pt")
sus_mod_plot_swot(swot, type = "radar",  lang = "en")
sus_mod_plot_swot(swot, type = "bar",    interactive = TRUE)
out <- sus_mod_plot_swot(swot, output_type = "all")
} # }