I want an R function that will let me do the following two things simultaneously:
- Plot arbitrary piecewise functions like scatterplot3d. That is, it should let me specify a arbitrary set of 3d coordinates at which points will be plotted.
- Let me set the viewpoint of the graph to arbitrary angles along both axises, like persp.
plot3d is not acceptable as it only allows manual adjustment of the plots once they are generated. I want to be able to script this.
In a pckage I’m currently developing, addendum, there is a function
plot4dthat gives a neat example if how to do that withrgl. You don’t have to use the package for it: just rip the source of the function.(note: you may get 2 warnings when loading the package – this is because of a minor glitch in the otherwise beautiful
glmnetpackage, and doesn’t break anything.)