问题
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