Closed HaoLi111 closed 3 years ago
You mean, you want to do something like this?
fit <- lm(Ozone ~ Solar.R + Wind + Temp + I(Wind^2) + I(Temp^2) +
I(Wind*Temp)+I(Wind*Temp^2) + I(Temp*Wind^2) + I(Temp^2*Wind^2),
data=airquality)
v <- visreg::visreg2d(fit, x="Wind", y="Temp", plot=FALSE)
plot3D::persp3D(v$x, v$y, v$z)
But have visreg provide a wrapper so that you can combine the last two lines of code into a single line?
This is great! And can we also have a parameter that add things onto a 3D plot with
persp3Drgl()
and perhaps having
add = True
or
add = False
to enable further customizations? (for example, we can see how the real data points compare to the surface)
I'm going to close this issue, at least for now. If there is substantial demand for this, I am certainly willing to add an option for persp3D
. It just seems to me that it is (a) pretty trivial to just do it yourself and (b) directly calling persp3D
will allow much more control over all the options, which is what you seem to be after, trying to customize the plot by displaying observed data points, etc.
Can we have an option to use Plot3D https://cran.r-project.org/web/packages/plot3D/vignettes/plot3D.pdf to create visualization for 2d -> 1d functions? it seems to be easier to use than most other packages. (especially if we can use add = TRUE, so that the actual data points can be plotted along with the regression surface?)