相关疑难解决方法(0)

用ggplot躲避点和误差线

考虑这些数据(请注意,这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
Run Code Online (Sandbox Code Playgroud)

我想用bar每个foo值绘制多个s ,其中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)
Run Code Online (Sandbox Code Playgroud)

我明白了:

但是我想让它躲避错误条和点,这样我才能看到重叠.使用position_jitter那样做,但它是完全随机的(或"笨重的") - 我不希望这样.

如何抵消个别观察?

或者这是ggplot的错误?此处 …

r ggplot2

8
推荐指数
1
解决办法
4733
查看次数

标签 统计

ggplot2 ×1

r ×1