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()
Let's assume that the dose
0.5
is significantly different from both dose 1
and 2
. Thus, I would expect something like this:
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.