2021年4月4日星期日

How to display `geom_boxplot` and `geom_dotplot` spaced in ggplot2 when plot both at same time?

I am working on a project and trying to reproduce following plot.

enter image description here

Here is my attempt.

test<-data.frame(    x=factor(rep(1:3, each=20)),    y=runif(60)  )  p<-ggplot(test, aes(x=x, y=y,fill=x)) +    geom_boxplot(width=0.2) +    geom_dotplot(binaxis = "y")  p  

But boxplot and dotplot are crowded together in my attempt. Any advice is appreciated.

https://stackoverflow.com/questions/66946547/how-to-display-geom-boxplot-and-geom-dotplot-spaced-in-ggplot2-when-plot-bot April 05, 2021 at 06:52AM

没有评论:

发表评论