# NOT RUN {
library(lattice)
data(sp1)
# 1. plotting mechanism for step-functions derived from soil profile data
xyplot(
cbind(top, bottom) ~ prop,
data = sp1,
id = sp1$id,
panel = panel.depth_function,
ylim = c(250, -10),
scales = list(y = list(tick.number = 10)),
xlab = 'Property',
ylab = 'Depth (cm)',
main = 'panel.depth_function() demo'
)
# 1.1 include groups argument to leverage lattice styling framework
sp1$group <- factor(sp1$group, labels = c('Group 1', 'Group2'))
xyplot(
cbind(top, bottom) ~ prop,
groups = group,
data = sp1,
id = sp1$id,
panel = panel.depth_function,
ylim = c(250, -10),
scales = list(y = list(tick.number = 10)),
xlab = 'Property',
ylab = 'Depth (cm)',
main = 'panel.depth_function() demo',
auto.key = list(
columns = 2,
points = FALSE,
lines = TRUE
),
par.settings = list(superpose.line = list(col = c(
'Orange', 'RoyalBlue'
)))
)
# }
Run the code above in your browser using DataLab