plot_pca_biplot: PCA Biplot of Soil Variables and Groups

View source: R/visualization.R

plot_pca_biplotR Documentation

PCA Biplot of Soil Variables and Groups

Description

Renders a PCA biplot showing both variable loadings and group centroids, using factoextra::fviz_pca_biplot. Useful for understanding variable relationships and group separation underlying MDS selection.

Usage

plot_pca_biplot(
  mds,
  scored,
  group_col = "LandUse",
  title = "PCA Biplot of Soil Quality Variables"
)

Arguments

mds

An object returned by select_mds.

scored

A scored data frame (for group colour coding).

group_col

Character. Column for group colours.

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"))
mds    <- select_mds(scored, group_cols = c("LandUse","Depth"))
plot_pca_biplot(mds, scored, group_col = "LandUse")


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