I have made a box plot with geometric means with the following code
bp.vals <- function(x, probs=c(0.05, 0.25, 0.75, .95)) {
r <- quantile(x, probs=probs, na.rm=TRUE)
r = c(r[1:2], exp(mean(log(x))), r[3:4])
names(r) <- c("ymin", "lower", "middle", "upper", "ymax")
r
}
ggplot(data_7m, aes(x=factor(BCG), y= IPVtype1_7m, fill=Group, width=0.4)) +
scale_fill_manual(values = c("dark grey", "light grey")) +
stat_summary(fun.data=bp.vals, geom="boxplot", show.legend=F) +
labs(x="", y="GMC(IU/mL)")
I would like to move the boxes closer together, but cannot get it to work. I have tried space, position and par()function.
Does anybody know how to do this?
Box plot geometric mean