Consistent width of boxplots if missing data by group?

后端 未结 1 850
無奈伤痛
無奈伤痛 2021-01-12 12:05

I have a similar question previously discussed for barplots, but with missing solution for boxplots: Consistent width for geom_bar in the e

相关标签:
1条回答
  • 2021-01-12 12:27

    We can make use of the preserve argument in position_dodge.

    From ?position_dodge

    preserve: Should dodging preserve the total width of all elements at a position, or the width of a single element?

    ggplot(data.sub, aes(x=variety, y=note, fill=treatment)) + 
     geom_boxplot(position = position_dodge(preserve = "single"))
    

    0 讨论(0)
提交回复
热议问题