I am trying to create a bar plot with a solid straight trendline but can't get the trendline to appear.
I am using the ggplot2 package and here is my current code for the bar plot:
library(ggplot2)
ggplot(mydf, aes(x=round, y=means, fill=round)) +
geom_smooth(method=lm, se=FALSE, col="black", linewidth=2) +
geom_bar(stat="identity", color="black", position=position_dodge()) +
geom_errorbar(aes(ymin=means-se, ymax=means+se), width=.2, position=position_dodge(.9),) +
theme_classic() +
xlab("Round") +
ylab("Bead Mass (g)") +
ggtitle("Verbal") +
theme(legend.position="none") +
geom_smooth(method=lm, se=FALSE, col="black", linewidth=2)
I'm not sure why the geom_smooth() section is not working. Any ideas?
See graph for what the output looks like