How to annotate pairwise p value from limma (3 groups) in a combine multiple boxplot?
Hi Biostar,
I have difficulty when trying to annotate pairwise p value from limma. Would you please have a suggestion? This code will annotate all boxplot the same value (0.01, 0.02, 0.03).
ggplot(long_data, aes(x = state, y = Score, fill = state)) +
geom_boxplot() +
facet_wrap(~ Pathway, scales = "free_y", ncol = 4) + # Adjust scales and ncol as needed
labs(title = "", x = "Disease state", y = "Pathway Score") +
theme_light() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), # Rotate x-axis text for readability
strip.text.x = element_text(size = 10)) + # Adjust size of facet labels if needed
geom_text(aes(x = Inf, y = 0.9, label = annotation_text),
hjust = 1.1, vjust = 2, size = 4, colour = "red", inherit.aes = FALSE) +
geom_signif(
annotations = c("0.01", "0.02",'0.03'),
comparisons = list(c("LS", "NC"), c("ES", "NC"), c('ES',"LS")),
y_position = c(0.3,0.4,0.5))
long_data from pivot_longer()
Thank you so much!
Update: stat_pvalue_manual() in ggboxplot() from library(ggpubr) worked!
• 621 views
•
link
0 answers
No answers yet.
Log in to answer this question.