0

I would like to connect two boxplots to show if they are significant in an external association analysis.

library(ggplot2)
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
head(ToothGrowth)
ggplot(ToothGrowth, aes(x=dose, y=len)) + 
  geom_boxplot()

enter image description here Let's assume that the dose 0.5 is significantly different from both dose 1 and 2. Thus, I would expect something like this:

enter image description here

Any idea how to draw it in ggplot2 in a smart way using ggplot2? I am aware about this post: Indicating significance with ggplot2, in a boxplot with multiple groups. However, it seems to work only when you run the analysis on the fly.

user3091668
  • 2,230
  • 6
  • 25
  • 42
  • And this post? (possible duplicate) https://stackoverflow.com/questions/17084566/put-stars-on-ggplot-barplots-and-boxplots-to-indicate-the-level-of-significanc – zx8754 Apr 02 '19 at 10:56
  • As far I can see, most of the alternatives run the analysis on the fly. I am looking for a fully customized notation. Maybe I failed to see an answer in the recommended post. – user3091668 Apr 02 '19 at 11:12
  • 1
    Please check `ggsignif` answer in the linked post (IMO right now this is the most easy to use tool for those kind of problems in ggplot2) – pogibas Apr 02 '19 at 11:53

0 Answers0