How to use ggplot2's geom_dotplot() with both fill and group

前端 未结 2 1571
北海茫月
北海茫月 2020-12-06 05:13

I really like the way the ggplot2::geom_dotplot() can nicely stack dots towards the middle of a category but I cannot seem to combine that with a fill color.

2条回答
  •  -上瘾入骨i
    2020-12-06 05:59

    I think you have to add the argument position = "dodge":

     ggplot(tmpData, aes(x = x, y = y, fill = fill,)) +
      geom_dotplot(binaxis = "y", stackdir = "center", dotsize = 4, position = "dodge")
    

    enter image description here

提交回复
热议问题