Plotting a “simple” regression (one regression) is pretty straight forward in R. Setup library(tidyverse) data(mtcars) library(mosaic) library(modelr) library(plotly) Define model lm1 <- lm(mpg ~ hp, data = mtcars) mtcars <- mtcars %>% mutate(lm1_pred = predict(lm1)) Plot One way: ggplot(mtcars) + aes(y = mpg, x = hp) + geom_point() + geom_lm() Another way: ggplot(mtcars) + aes(x = hp) + geom_point(aes(y = mpg)) + geom_point(aes(y = lm1_pred), color = "blue") + geom_line(aes(y = lm1_pred), color = "blue") Using the ggformula interface to …