How not to overlap statistical symbols (asterisks) on a comparison with multiple groups boxplot (ggplot2) ?
0
0
Entering edit mode
2.8 years ago
LuisNagano ▴ 90

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 • 962 views
ADD COMMENT

Login before adding your answer.

Traffic: 2150 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