How to annotate pairwise p value from limma (3 groups) in a combine multiple boxplot?
0
0
Entering edit mode
7 months ago
Chris ▴ 340

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!

limma boxplot • 228 views
ADD COMMENT

Login before adding your answer.

Traffic: 1640 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6