I'd like to show the mean value of each bar near the top of the bar plot a bit like the image below from this post.
I'm using the geom_text code from that post, but the plot is placing the variable's values all over the bars rather than just one mean value per bar the top of the bar.
ggplot(data=SocratesPreStudyApproved, aes(x=PlatformOrder, y=ReflectiveReflectionTest, fill=PlatformOrder))+
stat_summary(geom = "bar", fun = mean, position = "dodge", color="black")+
stat_summary(geom = "errorbar", fun.data = mean_se, position = "dodge", width=.2)+
stat_compare_means(method = "t.test", comparisons = PlatformComparisons, label = "p.signif")+
facet_wrap(~ReasoningPhilosophyOrder, scales="fixed", strip.position = "bottom")+
theme_classic()+
theme(legend.position = "none")+
labs(title = "Analyzing only approved participants (excluding rejected)",
x = "Platform within each condition order",
y = "Reflective responses to reasoning items (with lures)")+
scale_fill_grey(start = .6, end = 1)+
geom_text(aes(label = ReflectiveReflectionTest))
Adding X and Y values for geom_text doesn't seem to help, e.g.,
geom_text(aes(x=PlatformOrder, y=ReflectiveReflectionTest, label = ReflectiveReflectionTest))
Question
How do I get just one numeric label per bar (that is the mean value of that bar, which is also the height of the bar on the y-axis)?
(I've installed and loaded all of the packages from the post, but not found a solution.)



