Reputation: 29
I have a boxplot output in R using ggplot2. box plot i got using the below code
I want to label each box plot as labelled in the sample plot. sample plot i want to get
I have calculated p-value that is 0.06 for first egg1. i would like to paste this text on the plot as shown in the sample plot. how i can do that?
ggplot(testdata) +
geom_boxplot(aes(x=variable, y=value, color= as.factor (classification)))
Upvotes: 1
Views: 69
Reputation: 16178
You can use annotate
to add text on your boxplot:
ggplot(testdata) +
geom_boxplot(aes(x=variable, y=value, color= as.factor (classification))) +
annotate(geom="text", x=1, y=6, label="p = 0.06")
Upvotes: 1