为什么 xyplot() 和 dotplot() 使用相同的参数生成不同的图?

Why do xyplot() and dotplot() generate different plots with the same arguments?

为什么下面的代码会生成不同的图? xyplot() 和 dotplot() 有什么区别?

library(lme4)
library(lattice)
str(Dyestuff)

xyplot(reorder(Batch,Yield)~Yield,Dyestuff,ylab = "Batch", jitter.y = TRUE, pch = 21, aspect = 0.32,
   xlab = "Yield of dyestuff (grams of standard color)",
   type = c("p", "a","g"))

dotplot(reorder(Batch, Yield) ~ Yield, Dyestuff,
          ylab = "Batch", jitter.y = TRUE, pch = 21, aspect = 0.32,
          xlab = "Yield of dyestuff (grams of standard color)",
          type = c("p", "a"))

我假设您的问题是指 xyplotdotplot 中显示的 (不是点)不同这一事实。

这可能不是一个完整的答案,但您答案的关键似乎在 panel.xyplotpanel.dotplotpanel.average.

的文档中

指定 type = "a" 具有调用 panel.average 的效果。

xyplotdotplot 似乎对数据进行了不同的平均。虽然 xyplot 每个 Yield 平均 Batch 个值(这在这里不是很有意义,因为 Batch 是一个分类 factor 变量),dotplot 平均 YieldBatch 个值。