plot_scores: Plot Individual Variable Scores as a Heatmap

View source: R/visualization.R

plot_scoresR Documentation

Plot Individual Variable Scores as a Heatmap

Description

Displays a heatmap of mean variable scores (0–1) per group, allowing rapid visual identification of which variables drive high or low SQI within each land-use system.

Usage

plot_scores(
  scored,
  config,
  group_cols = "LandUse",
  group_by = group_cols[1],
  facet_by = NULL,
  palette = "RdYlGn",
  title = "Mean Variable Scores by Group"
)

Arguments

scored

A scored data frame from score_all.

config

A sqi_config object.

group_cols

Character vector. Grouping columns.

group_by

Character. Which grouping column to display on the x-axis.

facet_by

Character or NULL. Optional column to facet by (e.g., "Depth").

palette

Character. Colour palette: "RdYlGn" (default), "Blues", or any RColorBrewer name.

title

Character. Plot title.

Value

A ggplot object.

Examples

data(soil_data)
cfg <- make_config(
  variable = c("pH","EC","BD","OC","MBC","Clay"),
  type     = c("opt","less","less","more","more","opt"),
  opt_low  = c(6.0, NA, NA, NA, NA, 20),
  opt_high = c(7.0, NA, NA, NA, NA, 35)
)
scored <- score_all(soil_data, cfg, group_cols = c("LandUse","Depth"))
plot_scores(scored, cfg, group_cols = c("LandUse","Depth"),
            group_by = "LandUse", facet_by = "Depth")


SQIpro documentation built on April 20, 2026, 5:06 p.m.