geom_smooth for more than two variables

Solution 1:

You can manually create the plot using stat_function and the fit from your model, well described in this ggiraphExtra vignette. However, that package has a nice wrapper that can do exactly this.

library(ggiraphExtra)

mdl <- lm(data = mtcars, cyl ~ mpg + disp)
ggPredict(mdl)

enter image description here