I'm trying to make a scatter plot with two variables displayed and each have a regression line. I can get the scatter plot but when I try to add the regression line I get nothing but errors. I've tried multiple methods to try and get this to work but no luck. For this specific code I'm getting "Error: stat_smooth requires the following missing aesthetics: y". I've tried adding a formula but that doesn't work either. Any help would be appreciated!
TR <- ggplot(data = Throughfall, aes(x = Rainfall)) +
geom_point(aes(y = TF_Spruce, colour = "Spruce")) +
geom_point(aes(y = TF_Aspen, colour ="Aspen")) +
geom_smooth(method=lm) +
labs(title = "Throughfall vs Precipitation from two Yukon Forests", x = "Rainfall (mm)", y = "Throughfall (mm)", colour = "Tree Species") +
theme(axis.title=element_text(size=10)) +
theme(axis.text=element_text(size=12)) +
theme(plot.title=element_text(size=10, face = 'bold')) +
theme(
legend.position = c(0.15, 0.85),
legend.margin = margin(1, 3, 3, 3)
)