2015-09-01 74 views
6

我该如何避免附加箱形图?谢谢ggplot增加箱形图之间的距离

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

enter image description here

回答

3

position_dodge,该width参数可以与间距帮助

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)) 
相关问题