When new rgl devices open, the plot style is very different from the standard

When I use rgl package plot multiple 3D graphics in different canvases (rgl device) after using rgl.open () and set bg to white, the plotting style seems so different from the default. Is there a way to fix this? Please see the pictures below. When you rotate these two graphs, you can have a completely different experience. You can try drawing the same graph in the default canvas, open a new one, and draw the same drawing.

default plot canvasadded canvas

Also, is there a way to change the field of view coordinates from a cube to a sphere?

+3


source to share


2 answers


( edit ) Use open3d()

instead rgl.open()

to open a new window. The documentation warns about mixing calls rgl.*

with calls *3d

, and I assume this is an example. Here are three graphs - by 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 are side by side:



enter image description here

Session Information:

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

      

+7


source


If you want to maintain the same setup from session to session, I think you will need to open the "rgl" package at startup (see ?Startup

) and specify the parameter rgl.materials

you want to use. I searched for options in Index from help (package = rgl) and couldn't find the options settings. There r3dDefaults

is a list object in the workspace with a name that can be changed. Maybe:

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

      

Differences in device behavior between commands *.r3d

and commands are rgl.*

presented in ?r3d

and to a lesser extent in ?open.3d

.



For aiming at using a spherical coordinate see the page help(rgl.bg)

and try the "sphere = TRUE" argument. (I didn't find this pleasant, but YMMV.)

rgl.open()
rgl.bg(sphere=TRUE, color=c("grey","blue"), lit=FALSE, back="lines" )

      

+1


source







All Articles