I wanted to draw a scatter plot with ggplot which
geom_smooth(color = "black", alpha = 0.5, method = "lm", se = F)
Do you want something like this?
geom_abline(intercept = 0, slope = 1)
This wll draw a line with a 45º angle that goes through 0.
geom_smooth is computing the regression fr all the points. Try to remove all
color argument to get the smooth by group. You can check the different plots
a <- data.frame(x = c(1:10,2:11),y = c(2:11,1:10), label = c(rep("a",10),rep("b",10))) ggplot(a, aes(x,y)) + geom_point(aes(color = label)) + geom_smooth(aes(color = label)) ggplot(a, aes(x,y)) + geom_point(aes(color = label)) + geom_smooth(color="black")