I am trying to add significance asterisks to my ggplot boxplot, using groups (fill) and facets.
Using geom_signif()
I can add bars such as:
I am trying to do the same for the dodged boxplots too.. similar to
(Imagine there were significance values above the smaller lines...)
The code for the former graph:
data:
library(ggplot2)
library(ggsignif)
df <- data.frame(iris,petal.colour=c("red","blue"), country=c("UK","France","France"))
First plot:
ggplot(df, aes(country,Sepal.Length))+
geom_boxplot(position="dodge",aes(fill=petal.colour))+
facet_wrap(~Species, ncol=3)+
geom_signif(comparisons = list(c("France", "UK")), map_signif_level=TRUE,
tip_length=0,y_position = 9, textsize = 4)
and for the smaller bars
+geom_signif(annotations = c("", ""),
y_position = 8.5,
xmin=c(0.75,1.75), xmax=c(1.25,2.25),tip_length=0)
It would great to let R do the work, but if its easier to manually add text above these smaller lines then that's fine with me.