Soil Profile Sketches

Author

D.E. Beaudette

Published

September 5, 2023

Introduction

This is an expanded description of the arguments to plotSPC() and tips on making soil profile sketches look the way you want them to. Be sure to get the latest version of aqp.

Example Data

library(aqp)
library(soilDB)

# some interesting soil series
s <- c('leon', 'musick', 'clarksville', 'pardee', 'lucy', 'pierre', 'drummer', 'zook', 'san joaquin')

# get basic morphology and extended data from SoilWeb cache
osds.full <- fetchOSD(s, extended = TRUE)

# save copy of SoilProfileCollection for later
osds <- osds.full$SPC

Canvas

See the SPC introduction for the basics.

explainPlotSPC(osds)

Arguments to plotSPC

Options can be used to conveniently specify sets of arguments that will be used in several calls to plotSPC() within a single R session. For example, arguments can be specified in a named list (.a) and set using: options(.aqp.plotSPC.args = .a). Reset these options via options(.aqp.plotSPC.args = NULL). Arguments explicitly passed to plotSPC() will override arguments set via options().

x

A SoilProfileCollection object with one or more profiles. Large collections (>25 profiles) may be hard to interpret on screen. Consider save the output directly to a PNG or PDF, for example:

# start output device, dimensions are in pixels
png(filename = 'output.png', width = 1600, height = 800)

# plot
plotSPC(reallyBigSPC)

# close device, write file
dev.off()

Turning off ID and horizon designation annotation is another strategy for getting a quick glimpse of a large collection. Turning off profile and horizon boundary outlines with divide.hz = FALSE can help too.

# a single profile from our example
musick <- subset(osds, id == 'MUSICK')

# standard deviation of horizon boundary variation
horizons(musick)$hzb <- 10

# simulate 50 profiles
musick.sim <- perturb(musick, n = 50, boundary.attr = 'hzb')

# no margins
par(mar = c(0, 0, 0, 0))
# note other arguments used to improve legibility
plotSPC(musick.sim, print.id = FALSE, name = NA, width = 0.4, divide.hz = FALSE, depth.axis = list(line = -4, cex = 1))

Profile Arrangement

n

A single integer describing the amount of space along x-axis to allocate, defaults to length(x).

explainPlotSPC(osds, cex.names = 0.66, width = 0.3, n = 15, print.id = FALSE, name.style = 'center-center')

text(x = 10.5, y = 90, label = "additional space allocated by 'n = 15'", adj = 0, cex = 0.75)
arrows(x0 = length(osds) + 1, x1 = 15, y0 = 100, y1 = 100, code = 3, length = 0.1)

plot.order

integer vector describing the order in which individual soil profiles should be plotted

relative.pos

vector of relative positions along the x-axis, within {1, n}, ignores plot.order see details

add

When TRUE, sketches and annotations (like a depth axis) are added to the current output device. With careful use of x.idx.offset it is possible to combine several sets of profiles, such as the results of a simulation (see perturb()). With careful use of scaling.factor, profiles can be added to any figure.

# select first profile
x <- osds[1, ]

# convert horizon distinctness codes 
# to a horizon boundary "variability" index
horizons(x)$hzd <- hzDistinctnessCodeToOffset(x$distinctness) * 2

# generate 10 simulations
x.sim <- perturb(x, n = 10, boundary.attr = 'hzd')

# margins
par(mar = c(0, 0, 0, 0))

# plot the source profile, leaving room for 11 profiles (n = 11)
plotSPC(x, cex.names = 0.66, name.style = 'center-center', width = 0.3, depth.axis = FALSE, hz.depths = TRUE, hz.depths.offset = 0.05, n = 11, id.style = 'side', cex.id = 0.66, fixLabelCollisions = TRUE, max.depth = 145)

# add 10 simulations, offset 1 position to the right with x.idx.offset = 1
plotSPC(x.sim, cex.names = 0.66, name.style = 'center-center', width = 0.3, depth.axis = FALSE, hz.depths = TRUE, hz.depths.offset = 0.05, print.id = FALSE, add = TRUE, x.idx.offset = 1, fixLabelCollisions = TRUE, max.depth = 145)

# annotate simulations
arrows(x0 = 2, x1 = 11, y0 = -15, y1 = -15, length = 0.1, code = 3)
mtext('Simulation', side = 3, at = 5.5, line = -2.5, font = 2, adj = 0)