# Amend the plot to add another smooth layer with dummy grouping
fcyl=factor(mtcars$cyl)
ggplot(mtcars, aes(x = wt, y = mpg, color = fcyl)) +
geom_point() +
stat_smooth(method = "lm", se = FALSE) +
stat_smooth(method = "lm", se = FALSE, aes(group=1))
I don't understand aes(group=1) in the last line. Can anyone explain it? A very similar question is:
# Amend the plot
ggplot(mtcars, aes(x = wt, y = mpg, color = fcyl)) +
geom_point() +
# Map color to dummy variable "All"
stat_smooth(aes(color = "All"), se = FALSE) +
stat_smooth(method = "lm", se = FALSE)
I don't understand # Map color to dummy variable "All". (aes(color = "All"))