6
votes

I'm currently generating 3D graphs in R using the persp-command. To change the viewpoint one has to set the parameters theta and phi. To evaluate (a good viewpoint on) the graph, one has to try lots of combinations for these parameters.

I was wondering if one can define an interactive output device that allows to rotate the graph using the mouse. It would be also nice if this device gives the current values for theta and phi.

Is there such a device/package?

2
Have a look at the rgl package: rgl.neoscientists.org/about.shtml - Andrie

2 Answers

6
votes

See the rgl package: http://cran.r-project.org/web/packages/rgl/index.html

It won't report the theta and phi values you need, IIRC (though see @Dieter's comment below for a solution to this), but you can use rgl.snapshot() or rgl.postscript() to grab the current display as a bitmap or vector image. The package has persp3d() which is very similar to persp().

2
votes

See the package rggobi http://cran.r-project.org/web/packages/rggobi/index.html

For data visualisation in 3 or even more dimensions, try the package rggobi which makes use of the program ggobi. It is possible to manipulate the data using the mouse, "brush" data, identify points in the data all while visualizing in a number of dimensions.