# NOT RUN {
data(sp1)
# usually best to adjust margins
par(mar=c(0,0,3,0))
# 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)
# 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
data(sp4)
depths(sp4) <- id ~ top + bottom
plot(sp4, color='clay')
# another example
data(sp2)
depths(sp2) <- id ~ top + bottom
site(sp2) <- ~ surface
# label with site-level attribute: `surface`
plot(sp2, label='surface', plot.order=order(sp2$surface))
# example using a categorical attribute
plot(sp2, color = "plasticity")
# plot two SPC objects in the same figure
par(mar=c(1,1,1,1))
# plot the first SPC object and
# allocate space for the second SPC object
plot(sp1, n=length(sp1) + length(sp2))
# plot the second SPC, starting from the first empty space
plot(sp2, x.idx.offset=length(sp1), add=TRUE)
##
## demonstrate adaptive legend
##
data(sp3)
depths(sp3) <- id ~ top + bottom
# make some fake categorical data
horizons(sp3)$fake.data <- sample(letters[1:15], size = nrow(sp3), replace=TRUE)
# better margins
par(mar=c(0,0,3,1))
# note that there are enough colors for 15 classes (vs. previous limit of 10)
# note that the legend is split into 2 rows when length(classes) > n.legend argument
plot(sp3, color='fake.data', name='fake.data', cex.names=0.8)
# make enough room in a single legend row
plot(sp3, color='fake.data', name='fake.data', cex.names=0.8, n.legend=15)
# }
Run the code above in your browser using DataLab