I've created a boxplot using the following code -
ggplot(xray50g, aes(fill = SupplyingSite, x = factor(SupplyingSite, level = level_order), y =
DefScore)) +
geom_boxplot() +
geom_point() +
theme(legend.position = "top") +
# REDUCE X AXIS TEXT SIZE
theme(axis.text.x = element_text(size = 10)) +
# USE ENVSTATS PACKAGE TO INCLUDE SAMPLE SIZE
stat_n_text(size = 3) +
# INCLUDE CALCULATED MEAN VALUES
stat_summary(fun = mean, colour = "orange", geom = "point", size = 2,show.legend = FALSE) +
geom_text(data = means, vjust = -1.5, hjust = -0.18, size = 3, aes(label = round(DefScore, 2),
y = DefScore + 0.08)) +
# ADD HORIZONTAL LINE AT BASE MEAN
geom_hline(yintercept = mean(xray50g$DefScore), linetype = 2) +
# ADD GLOBAL ANNOVA P-VALUE
stat_compare_means(method = "anova", label.y = 26, size = 4) +
# PAIRWISE COMPARISON AGAINST ALL
stat_compare_means(label = "p.signif", method = "t.test", ref.group = ".all.",
label.y = 24, size = 4) +
# USE ANNOTATE FUNCTION TO ADD MEAN PREVALENCE VALUE
annotate(geom = "text", x = 8.5, y = 3.4, label = overallmean2, color = "red", size = 3)
The plot looks like this with a grey background -
What I would like is for the plot to have a white background like this example -
Is there a simple way to achieve this?