I am trying to increase the space between box plots in a diagram generated by ggplot2
. I found an answer to how to do it for barplots which I was not able to adapt but which at least makes me more hopeful. I have the following code:
library('ggplot2')
FOO <- runif(30, min=0, max=10);
BAR <- rep(c("a", "b", "c"), 10)
df <- data.frame(FOO, BAR);
ggplot(df, aes(x = BAR, y = FOO)) + geom_boxplot(outlier.shape = NA, fill = "grey80",alpha = 0.3) + geom_point(position = position_jitter(w = 0.5, h = 0)) + theme_bw()
It is really difficult to see which dataset the dots belong to. I realise that I can change the w
in the position_jitter
but that also increases the risk of overlap. I would like to also be able to increase the space between the plots. How can this be done?