此代码在ggplot2中绘制了具有交互的回归线:
library(ggplot2) ggplot(mtcars, aes(hp, mpg, group = cyl)) + geom_point() + stat_smooth(method = "lm")
没有相互作用的线可以用stat_smooth?
stat_smooth