ggplot increase distance between boxplots

一个人想着一个人 提交于 2019-12-07 02:16:53

问题


How can I avoid attached box-plots? Thank you

ggplot(df, aes(x=factor(time), y=val, fill=ID))+
geom_boxplot()+
scale_fill_manual(values=c(WT="goldenrod3", KO="steelblue"))


回答1:


Look at position_dodge, the width argument can help with spacing

mtcars$sep <- 1:2  # a factor

ggplot(mtcars, aes(x=factor(carb), y=mpg, fill=factor(sep))) +
  geom_boxplot(position=position_dodge(width=0.8))


来源:https://stackoverflow.com/questions/32342616/ggplot-increase-distance-between-boxplots

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!