Entering edit mode
3.4 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!
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")