# \donttest{
if(
requireNamespace("compositions") &
requireNamespace("soiltexture")
) {
# sample data, data.frame
data('sp4')
# filter just Bt horizon data
ssc <- sp4[grep('^Bt', sp4$name), c('sand', 'silt', 'clay')]
names(ssc) <- toupper(names(ssc))
# simulate 100 samples
s <- bootstrapSoilTexture(ssc, n = 100)
s <- s$samples
# empty soil texture triangle
TT <- soiltexture::TT.plot(
class.sys= "USDA-NCSS.TT",
main= "",
tri.sum.tst=FALSE,
cex.lab=0.75,
cex.axis=0.75,
frame.bg.col='white',
class.lab.col='black',
lwd.axis=1.5,
arrows.show=TRUE,
new.mar = c(3, 0, 0, 0)
)
# add original data points
soiltexture::TT.points(
tri.data = s, geo = TT, col='firebrick',
pch = 3, cex = 0.5, lwd = 1,
tri.sum.tst = FALSE
)
# add simulated points
soiltexture::TT.points(
tri.data = ssc, geo = TT, bg='royalblue',
pch = 22, cex = 1, lwd = 1,
tri.sum.tst = FALSE
)
# simple legend
legend('top',
legend = c('Source', 'Simulated'),
pch = c(22, 3),
col = c('black', 'firebrick'),
pt.bg = c('royalblue', NA),
horiz = TRUE, bty = 'n'
)
}
# }
Run the code above in your browser using DataLab