【问题标题】:Why do xyplot() and dotplot() generate different plots with the same arguments?为什么 xyplot() 和 dotplot() 使用相同的参数生成不同的图?
【发布时间】:2019-08-29 05:27:24
【问题描述】:

为什么以下代码会生成不同的图? 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"))

【问题讨论】:

    标签: r plot lattice


    【解决方案1】:

    我认为您的问题是指xyplotdotplot 中显示的(不是点)不同。

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

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

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

    【讨论】:

      猜你喜欢
      • 2020-09-22
      • 2020-12-13
      • 2021-07-11
      • 2014-04-11
      • 2020-06-23
      • 1970-01-01
      • 1970-01-01
      • 2011-01-14
      • 2012-07-24
      相关资源
      最近更新 更多