【发布时间】:2014-11-05 12:28:41
【问题描述】:
考虑这个数据(注意foo实际上是一个因素。):
foo bar outcome ci
1 a 0.683333333 0.247447165
2 b 0.941666667 0.180356565
3 c 0.783333333 0.335337789
1 d 0.866666667 0.204453706
2 e 0.45 0.303059647
3 f 0.325 0.340780173
我想为每个foo 值绘制多个bars,它们的outcome 和带有CI 的误差线。这是我的工作:
ggplot(ex, aes(foo, outcome, label = bar)) +
geom_point(position = position_dodge(.1)) +
geom_errorbar(aes(ymin = outcome - ci, ymax = outcome + ci), position = position_dodge(.1)) +
geom_text(hjust = 2)
我明白了:
但我希望它避开误差线和点,以便我可以看到重叠。 Using position_jitter did that,但它完全是随机的(或 "clunky")——我不希望这样。
如何抵消个别观察?
或者这是 ggplot 的错误? example here 也有shows this error。
【问题讨论】: