# NOT RUN {
# Fit a model and construct a visreg object
airquality$Heat <- cut(airquality$Temp,3,labels=c("Cool","Mild","Hot"))
fit <- lm(Ozone~ Solar.R + Wind*Heat,data=airquality)
v <- visreg(fit, "Wind", by="Heat", plot=FALSE)
# Plot only certain levels
vv <- subset(v, Heat %in% c("Cool", "Hot"))
plot(vv)
# Plot only up to wind 15 mph
vv <- subset(v, Wind < 15)
plot(vv)
# }
Run the code above in your browser using DataLab