Try with explicitly indicating the position
:
ggplot(Data_long, aes(x = variable,y = value, fill = GD))+
geom_boxplot()+
stat_boxplot(geom = "errorbar", width = 0.2, color="black", position = position_dodge(.75)) +
stat_summary(fun = "mean", geom = "point", size = 1.5, col = "red", position = position_dodge(.75))
Just a note: while it can make sense to indicate the mean on top of a boxplot (which by default uses the median), I'm not sure what is your goal with the error bars: here you use the same bars that are already drawn by geom_boxplot()
, they don't really bring any useful information.