Some time ago I asked a question about drawing boxplot Link1.
I have got some data with 3 different groups (or labels) Please down load here. I can use the following R codes to get the boxplot
library(reshape2)
library(ggplot2)
morphData <- read.table(".\\TestData3.csv", sep=",", header=TRUE);
morphData.reshaped <- melt(morphData, id.var = "Label")
ggplot(data = morphData.reshaped, aes(x=variable, y=value)) +
+ geom_boxplot(aes(fill=Label))
Here I just wondering how to put the significant level above the boxplot. To make myself clear I put a screenshot cut from a paper here:
I don't quite understand what you mean by boxplot with significant level but here a suggestion how you can generate those bars: I would solve this constructing small dataframes with the coordinates of the bars. Here an example:
I know that this is an old question and the answer by DatamineR already provides one solution for the problem. But I recently created a ggplot-extension that simplifies the whole process of adding significance bars: ggsignif
Instead of tediously adding the
geom_line
andannotate
to your plot you just add a single layergeom_signif
:Full documentation of the package is available at CRAN.