[Solved] Add regression line legend to geom_abline


With slight modification your code works just fine:

ggplot() + 
geom_point(mapping = aes(x = X, y = y)) + 
   geom_abline(aes(colour = "line_1",  intercept = -0.9930872, slope = 0.4866284)) + 
   geom_abline(aes(colour = "line_2", intercept = -1, slope = 0.5)) +
   scale_colour_manual(name = "lines", values = c("red", "blue")) +
   theme(legend.position = "bottom")

Added legend position in case if you want to change that aswell.

solved Add regression line legend to geom_abline