I want to have a box plot with the significance level (e.g. ***) over each group, without a line. The comparison to generate the p value/significance level will be for each test group relative to a single control group.
I have a lot of different graphs to make, which means creating and positioning a text box manually for each will be prohibitively time consuming. Therefore, I wish to use the geom_signif function to auto calculate and position these.
I am able to create something like the following:
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
ggplot(data=ToothGrowth, aes(x=dose, y=len)) +
geom_boxplot() +
geom_signif(comparisons=list(c("0.5", "1"),
c("0.5", "2")),
map_signif_level=TRUE, y_position = c(40, 45))
This is fine for two or three groups, but gets messy for larger numbers of groups such as in the data set I am working with.
An alternative approach:
ggplot(data=ToothGrowth, aes(x=dose, y=len)) +
geom_boxplot() +
geom_signif(comparisons=list(c("0.5", "1"),
c("0.5", "2")),
map_signif_level=TRUE)
This looks awful. However, if the significance signs could be spaced to match the x-axis ticks, and preferably if the line could be removed/hidden, this would be ideal.
Can anyone demonstrate how to do this?