Plot a dendrogram based on the first 4 levels of Soil Taxonomy, with soil profiles hanging below. A dissimilarity matrix is computed using Gower's distance metric for nominal (KST.order = FALSE) or ordinal (KST.order = TRUE) scale variables, based on soil order, suborder, greatgroup, and subgroup taxa.

SoilTaxonomyDendrogram(
  spc,
  KST.order = TRUE,
  rotationOrder = NULL,
  name = "hzname",
  name.style = "center-center",
  id.style = "side",
  max.depth = max(spc),
  n.depth.ticks = 6,
  scaling.factor = 0.015,
  cex.names = 0.75,
  cex.id = 0.75,
  axis.line.offset = -4,
  width = 0.1,
  y.offset = 0.5,
  shrink = FALSE,
  font.id = 2,
  cex.taxon.labels = 0.66,
  dend.color = par("fg"),
  dend.width = 1,
  ...
)

Arguments

spc

a SoilProfileCollection object, typically returned by soilDB::fetchOSD

KST.order

logical, encode / cluster taxa via ordinal factors, based on ordering within Keys to Soil Taxonomy

rotationOrder

character vector of profile IDs with desired ordering of leaves in the dendrogram from left to right; exact ordering is not always possible

name

column name containing horizon names

name.style

passed to aqp::plotSPC

id.style

passed to aqp::plotSPC

max.depth

depth at which profiles are truncated for plotting

n.depth.ticks

suggested number of ticks on the depth axis

scaling.factor

scaling factor used to convert depth units into plotting units

cex.names

character scaling for horizon names

cex.id

character scaling for profile IDs

axis.line.offset

horizontal offset for depth axis

width

width of profiles

y.offset

vertical offset between dendrogram and profiles

shrink

logical, should long horizon names be shrunk by 80% ?

font.id

font style applied to profile id, default is 2 (bold)

cex.taxon.labels

character scaling for taxonomic information

dend.color

dendrogram line color

dend.width

dendrogram line width

...

additional arguments to aqp::plotSPC

Value

An invisibly-returned list containing:

  • dist: pair-wise dissimilarity matrix

  • order: final ordering of hclust leaves

Details

This function looks for specific site-level attributes named: soilorder, suborder, greatgroup, and subgroup. See misc/soilTaxonomyDendrogram-examples.R for some examples.

The rotationOrder argument uses ape::rotateConstr() to reorder leaves within the hclust representation of the ST hierarchy. Perfect sorting is not always possible.

Author

D.E. Beaudette

Examples


# built-in data, same as results from soilDB::fetchOSD()
data("OSDexamples")

# examples using first 8 profiles

## TODO: uncomment once latest SoilTaxonomy is on CRAN
# KST-style ordering
# SoilTaxonomyDendrogram(
# OSDexamples$SPC[1:8, ], width = 0.3, name.style = 'center-center',
# KST.order = TRUE
# )

# classic ordering, based on nominal scale variables (unordered factors)
SoilTaxonomyDendrogram(
OSDexamples$SPC[1:8, ], width = 0.3, name.style = 'center-center',
KST.order = FALSE
)