This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How not to overlap statistical symbols (asterisks) on a comparison with multiple groups boxplot (ggplot2) ?

Hi, guys, I’d like to make a boxplot, comparing all Subgroups of my data through the Wilcox test, plotting the asterisks separately with the blackets.

For example: (Cancer1 vs Cancer2, Cancer1 vs Cancer3, Cancer1 vs Cancer4, Cancer2 vs Cancer3, Cancer2 vs Cancer4, Cancer3 vs Cancer4)

I used the code below, but the asterisks and NS overlapped (Figure below). I’d like the asterisks to be separated and the comparisons indicated by the blackets (stat bars). Do you have any suggestions?

Many thanks!

enter image description here

library(ggplot2)
library(ggpubr)
ggplot(tab_expression, 
          aes(x=Genes, 
              y=Expression, 
              fill=subgroup)) + 
geom_boxplot()+
stat_compare_means(aes(group = subgroup),
                 label = "p.signif", 
                 method = "wilcox.test", 
                 paired = F)+
labs(x = "Genes", y="Expression", fill = "Subgroups")
asterisks ggplot2 boxplot stats multiplegroups

0 answers

No answers yet.

Log in to answer this question.