plotSPC(x, color='soil_color', width=0.2, name='name', alt.label=NULL,
cex.names=0.5, cex.depth.axis=cex.names, cex.id=cex.names+(0.2*cex.names), print.id=TRUE,
id.style='auto', plot.order=1:length(x), add=FALSE, scaling.factor=1, y.offset=0, n=length(x),
max.depth=max(x), n.depth.ticks=5, shrink=FALSE, shrink.cutoff=3, abbr=FALSE,
abbr.cutoff=5, divide.hz=TRUE, hz.distinctness.offset=NULL, hz.distinctness.offset.col='black',
hz.distinctness.offset.lty=2, axis.line.offset=-2.5, ...)
pretty()
function. You may have to tinker with both parameters to get what you want. The 'side' id.style
is useful when plotting a large collection of profiles, and/or, when profile IDs are long.SoilProfileCollection-class, pretty, hzDistinctnessCodeToOffset
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