Reputation: 25
I would like to manually add text to indicate significant differences on my graphs by adding letters (e.g. a, b and c) over specific locations on my boxplot using ggplot2. So essentially, I want to be able to add text where I want on the plot.
I have added an example of a graph in the picture above. I have entered the letters (a,b,c) manually in Microsoft Word but I would like to be able to do this in R. Can someone please help? Thank you
Upvotes: 1
Views: 1716
Reputation: 3228
Alternatively, you can try this. "Data" and "variable" are just names for what you would put in:
ggplot(data,aes(x=variable))+
geom_boxplot(aes(y=variable2),color="variable")
Upvotes: 0
Reputation: 78927
just add this line to your code:
annotate("text", x = 3, y=10, label = "whatever")
Upvotes: 1