I am trying to add labels (letters) above a barplot using ggplot2 function geom_text
. My bars are separated using position=position_dodge()
and so I need to apply the same for the new labels. However I would like to use also nudge_y
to separate the labels from the bar. If I try to use both together R complains that I can use only one of either options. I'd like to do something like this:
Tukey.labels <- geom_text(data=stats,
aes(x=factor(Treatment2), y=x.mean,
label=Tukey.dif),
size=4, nudge_y=3, # move letters in Y
position=position_dodge(0.5)) # move letters in X
To create something like this image Does anybody knows a possibility to shift all my labels the same distance in Y while doing position_dodge
at the same time? I could not find answer for this in other posts