I am trying to create a faceted plot like below. However, stats always only get applied to one of the plots. Is there a workaround keeping the figure appearance the same, but adding stats to both?
Here is the code that I am using
ggplot(dat, aes(x=`Treatment`,y=`Endostatin`, fill=Treatment))+
geom_boxplot(outlier.alpha = 0.25, outlier.color = "red") +
geom_point(alpha = 0.25, size = 2 ) +
facet_wrap(~Mode, scale="free") +
stat_compare_means(comparisons = my_comparisons) +
theme(axis.text.x = element_text(angle = 20))

You should add stat_compare_means separately
my_comparisons1 <- list(c("SHAM+vehicle", "TAC+vehicle"), c("TAC+vehicle", "TAC+relaxin"), c("TAC_vehicle", "TAC+Enalapril"))
my_comparisons2 <- list(c("TAC+vehicle", "TAC+relaxin")
stat_compare_means(comparisons = my_comparisons1 ) +
stat_compare_means(comparisons = my_comparisons2 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With