【发布时间】:2020-10-30 10:05:49
【问题描述】:
我很难让geom_jitter 用第三个变量(相位)分隔我的数据点。
我希望这个 2x2 图表中的每个条形都有自己的一组针对每个相位条件的抖动数据点。
现在点在两个阶段栏之间分组(抱歉无法上传图片——我的 10 个帖子还没有)。
我知道我在geom_jitter aes 中遗漏了一些东西,但不确定它是什么——fill=phase 没有做到这一点。
ggplot(datalong, aes(grp, score)) +
geom_bar(stat = "summary", fun.y = "mean", aes(fill=phase), position = "dodge", alpha = .5) +
geom_jitter(inherit.aes = FALSE, aes(grp, score, fill=phase), position = position_jitter(0.2))
【问题讨论】:
-
您能否举一个最小的可重现示例。你可以看看这篇文章:stackoverflow.com/questions/10493084/…