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')
# 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)
# assign color based on clay content, rescaled to {0,1}
sp3$soil_color <- rgb(cr(rescaler(sp3$clay, type='range')), max=255)
depths(sp3) <- id ~ top + bottom
plot(sp3)
}
Run the code above in your browser using DataLab