简体   繁体   English

ggplot增加箱形图之间的距离

[英]ggplot increase distance between boxplots

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"))

在此处输入图片说明

Look at position_dodge , the width argument can help with spacing 查看position_dodgewidth参数可以帮助间距

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))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM