I want to plot the regression surface from a model with an interaction term using rgl\'s interactive plotting system. It is easy to plot a regression plane for a m
rgl
grd <- expand.grid(x1=unique(x1), x2=unique(x2) ) grd$pred <-predict(mod2, newdata=grd) persp3d(x=unique(grd[[1]]), y=unique(grd[[2]]), z=matrix(grd[[3]],5,5), add=TRUE)