How to make dodge in geom_bar agree with dodge in geom_errorbar, geom_point

前端 未结 4 896
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 12:10

I have a dataset where measurements are made for different groups at different days.

I want to have side by side bars representing the measurements at the different

4条回答
  •  自闭症患者
    2020-11-30 12:48

    This is an old question, but since i ran into the problem today, i want to add the following:

    In

     geom_bar(position = position_dodge(width=0.9), stat = "identity") + 
       geom_errorbar( position = position_dodge(width=0.9), colour="black") 
    

    the width-argument within position_dodge controls the dodging width of the things to dodge from each other. However, this produces whiskers as wide as the bars, which is possibly undesired. An additional width-argument outside the position_dodge controls the width of the whiskers (and bars):

     geom_bar(position = position_dodge(width=0.9), stat = "identity", width=0.7) + 
       geom_errorbar( position = position_dodge(width=0.9), colour="black", width=0.3) 
    

提交回复
热议问题