79677909

Date: 2025-06-24 16:26:11
Score: 1
Natty:
Report link

I have recently been working on something similar, and while I know that this is an old post I thought I should post the solution that I came to. I have found that geom_pwc() does this and just works.

As an example using the ToothGrowth dataset:

ggboxplot(ToothGrowth, 
          x = "dose", 
          y = "len",
          color = "dose", 
          palette = "jco",
          add = "jitter",
          facet.by = "supp", 
          short.panel.labs = FALSE)+
  geom_pwc(method = "wilcox.test",
           label = "p.signif",
           hide.ns = TRUE)

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Andrew Reed