I am plotting two regression models in one graph by overlaying over each other. But i am unable to display the legend. I am using a code:
ggplot(df, aes(x)) + # basic graphical object
geom_smooth(aes(y = predict(regressor1)), colour = "black") +
geom_smooth(aes(y = predict(regressor2)), colour = "blue") +
labs(x = "Distance from the scanner", y = "RMSE (m)") +
scale_colour_manual(name = "", values = c("black" = "Moo", "blue" = "Coo"),
guide = 'legend') +
guides(colour = guide_legend(override.aes = list(linetype = c(1, 0),
shape = c(NA, 16)))) +
theme_classic() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.title.x = element_text(size = 16),
axis.title = element_text(size = 16),
axis.text.x = element_text(size = 14, colour = "black"),
axis.text.y = element_text(size = 14, colour = "black"))
How can I display the legend manually, here?