Skip to contents
fit <- lm(Ozone ~ Solar.R + Wind + Temp, data = airquality)

and then you pass it to visreg:

visreg(fit, "Wind")

A more complex example, which uses the gam() function from mgcv:

library(mgcv)
Loading required package: nlme

Attaching package: 'nlme'
The following object is masked from 'package:visreg':

    collapse
This is mgcv 1.9-4. For overview type '?mgcv'.
airquality$Heat <- cut(airquality$Temp, 3, labels = c("Cool", "Mild", "Hot"))
fit <- gam(Ozone ~ s(Wind, by = Heat, sp = 0.1), data = airquality)
visreg(fit, "Wind", "Heat") + ylab("Ozone")