I am having trouble displaing the contributing fractions in my depth plot, as their the top number at each 10cm depth should be in black and the second in blue not alternating every depth step like it is displayed now.
This is my code so far:
idx_veg <- which(a$LU == 'Vegetated LU')
veg <- slab(a[idx_veg, ], fm= ~ TOC + TIC + Clay + Silt + Sand + Nitrogen..)
idx_mod <- which(a$LU == 'Moderately Degraded LU')
mod <- slab(a[idx_mod, ], fm= ~ TOC + TIC + Clay + Silt + Sand + Nitrogen..)
#combine with the collection-wide aggregate data
g <- make.groups(veg=veg, mod=mod)
xyplot(top ~ p.q50 | variable, groups=which, data=g, ylab='Depth [cm]',
   xlab='median bounded by 25th and 75th percentiles',
   lower=g$p.q25, upper=g$p.q75, ylim=c(60,-2), #ylim defines the y-axis depth
   panel=panel.depth_function,
   alpha=0.15, sync.colors=TRUE, #alpha = transparency of 25-75% interval
   par.settings=list(superpose.line=list(col=c('black', 'RoyalBlue'), lwd=1, lty=c(1,2))), #median line, colour and width
   prepanel=prepanel.depth_function,
   cf=g$contributing_fraction, cf.col=c('black', 'RoyalBlue'), cf.interval=10, #contributing fractions (right hand side x-axis)
   layout=c(6,1), strip=strip.custom(bg=grey(0.8)), #Layout = arrangement of panels of plots
   scales=list(x=list(tick.number=4, alternating=3, relation='free')),# x, y-axis
   auto.key=list(columns=2, lines=TRUE, points=FALSE)
)
The warning I need to deal with and which will probably elimate the problem is:
In if (is.na(cf.col)) { ... :
the condition has length > 1 and only the first element will be used
Thanks for any advice.

 
     
    