How to increase the space between the bars in a bar plot in ggplot2?

前端 未结 4 801
自闭症患者
自闭症患者 2020-11-28 23:34

How can I increase the space between the bars in a bar plot in ggplot2 ?

4条回答
  •  无人及你
    2020-11-29 00:16

    For space between factor bars use

    ggplot(data = d, aes(x=X, y=Y, fill=F)) 
     + geom_bar(width = 0.8, position = position_dodge(width = 0.9))
    

    The width in geom_bar controls the bar width in relation to the x-axis while the width in position_dodge control the width of the space given to both bars also in relation to the x-axis. Play around with the width to find one that you like.

提交回复
热议问题