data(sp1)
# add color vector
sp1$soil_color <- with(sp1, munsell2rgb(hue, value, chroma))
# promote to SoilProfileCollection
depths(sp1) <- id ~ top + bottom
# plot profiles
plot(sp1, id.style='side')
# title, note line argument:
title('Sample Data 1', line=-1, cex.main=0.75)
# plot profiles without horizon-line divisions
plot(sp1, divide.hz=FALSE)
# plot profiles, using alternate profile ID label style
plot(sp1, id.style='side')
# add dashed lines illustrating horizon boundary distinctness
sp1$hzD <- hzDistinctnessCodeToOffset(sp1$bound_distinct)
plot(sp1, hz.distinctness.offset='hzD')
# plot horizon color according to some property
# RColorBrewer helps with nice colors
if(require(RColorBrewer)) {
data(sp3)
# setup colors
cols <- rev(brewer.pal(8, 'Spectral'))
cr <- colorRamp(cols)
library(scales)
# assign color based on clay content, rescaled to {0,1}
sp3$soil_color <- rgb(cr(rescale(sp3$clay)), max=255)
depths(sp3) <- id ~ top + bottom
plot(sp3)
}Run the code above in your browser using DataLab