Hopefully a pretty simply problem to solve - I have produced the boxplot pictured using the following code
ggplot(minanalysis, aes(x=MinAnaType, y=Calcium)) +
geom_boxplot() +
geom_point(aes(colour=Ploidy)) +
stat_summary(fun.y=mean, colour="black", geom="point", size=2,show.legend = FALSE) +
geom_text(data = means, vjust = -0.25, hjust=-0.3, size = 3, aes(label = round(Calcium, 2),
y = Calcium + 0.08)) +
#add a sample size n =
geom_text(data = minanalysis %>% group_by(MinAnaType) %>%
summarize(Count = n(),
Calcium=max(Calcium) + 0.05 * diff(range(minanalysis$Calcium))),
aes(label = paste0("n = ", Count)),
position = position_dodge(0.85), size=3, show.legend = FALSE) +
# Add pairwise comparisons p-value and global p-value
stat_compare_means(comparisons = my_comparisons, label = "p.signif", label.y = 9500, size = 4) +
stat_compare_means(label.y = 10500, size = 4)
What I want is for the "n=290" and n=50" to be located underneath x axis labels 'Eviscerated' and 'WholeBody'. Having them above the boxplots themselves is too messy. Could somebody help with the code for this, I'm new to R studio.
Thanks