Well, this isn't real pretty, but it should get the real job (showing you how to get this kind of plot working) done.
The basic idea is to rewrite the formula so that it doesn't have a bunch of names on its LHS (i.e. lower.bound + mean + upper.bound
). That syntax is equivalent to specifying a groups=
term, which ends up triggering panel.superpose()
which is kind of a pain to customize in the way you want.
Instead, I just include mean
on the LHS, and then use subscripts
inside of the custom panel function to pick out in each case the matching elements of upper.bound
and lower.bound
.
I'm hoping the rest is pretty self explanatory:
LABS <- LETTERS[1:4]
with(df,
dotplot(mean ~ code | problem * topic,
lb=lower.bound, ub=upper.bound, mpch = c(3,1)[consistent+1],
ylim = extendrange(c(0,100)),
panel = function(x, y, lb, ub, mpch, ..., subscripts) {
panel.dotplot(x, y, ..., pch=mpch[subscripts])
lpoints(x, lb[subscripts], pch=6)
lpoints(x, ub[subscripts], pch=2)
lsegments(x,lb[subscripts],x,ub[subscripts],col="grey60")
ltext(x=x[3], y=95, LABS[panel.number()], col="red",fontface=2)
},
scales = list(x = list(draw = FALSE)), as.table = TRUE)
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…