Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an interactive output device to view 3D graphs in R?

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?

like image 850
R_User Avatar asked Nov 02 '11 08:11

R_User


2 Answers

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().

like image 77
Gavin Simpson Avatar answered Sep 22 '22 11:09

Gavin Simpson


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.

like image 32
user898250 Avatar answered Sep 18 '22 11:09

user898250