Question

When I use rgl package plot several 3d graphics in different canvas(rgl device) after using rgl.open() and set the bg as white, the plotting style seems so different from the default one. Is there a way to set this? Please see pics show below. When rotate those two graphs, very different experience you can get. You can try plot same graph in default canvas, open a new one and plot the same pic.

default plot canvasadded canvas

Besides, is there a way to change the outter box of the coordinate from a cube to a sphere?

Was it helpful?

Solution

(edit) Use open3d() instead of rgl.open() to open the new window. The documentation warns against mixing rgl.* calls with *3d calls, and I guess this is an example. Here are three plots -- default, rgl.open(), and open3d() ...

library(rgl)
plot3d(1:4,1:4,1:4)
rgl.open()
plot3d(1:4,1:4,1:4)
open3d()
plot3d(1:4,1:4,1:4)

And the results side-by-side:

enter image description here

Session info:

R Under development (unstable) (2012-12-14 r61321)
Platform: i686-pc-linux-gnu (32-bit)
[locale snipped]
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] rgl_0.92.894

OTHER TIPS

If you wanted to maintain the same setup from session to session I think you would need to open package 'rgl' at startup (see ?Startup) and specify the rgl.materials setting that you wanted to use. I have searched for options settings in the Index from help(package=rgl) and failed to find an options setting. There is a list object in the workspace named r3dDefaults which could be modified. Perhaps:

r3dDefaults$bg$color <- "white"   # Change the value to get something different
# > names(r3dDefaults)
# [1] "userMatrix" "mouseMode"  "FOV"        "bg"         "family"     "material"  

The differences between device behavior between the *.r3d commands and the rgl.* commands are laid out in ?r3d and to a less complete extent in ?open.3d .

Regarding the desire for a spherical coordinate reference see the help(rgl.bg) page and try out the 'sphere=TRUE' argument. (I didn't find it that pleasing but YMMV.)

rgl.open()
rgl.bg(sphere=TRUE, color=c("grey","blue"), lit=FALSE, back="lines" )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top