plot3d - having two plots at once

You might discover that the 2nd rgl plotting window has simply been placed exactly on top of the earlier window. If you move the second window you will see the first one is still there (although not now having "Focus" status.) There is no need to plot to the devices in order to keep them available. You change the window that gets the focus with rgl.set:

> open3d()
[1] 3     # might have been "1"
> open3d()
[1] 4    # Now move that 2nd  window to the side 
> rgl.set(3)
#Focus is returned to the first window.

You cannot have 2 windows active (in the sense of getting commands) at once, but you can have them both visible, and if one was set spinning it would continue to spin after focus were shifted to the other window. You can also add to an existing plot with the plot3d function if you set add=TRUE.


like this:

 library(rgl)

 open3d()
 x <- sort(rnorm(1000))
 y <- rnorm(1000)
 z <- rnorm(1000) + atan2(x,y)
 plot3d(x, y, z, col=rainbow(1000))

 open3d()
 x <- sort(rnorm(20))
 y <- rnorm(20)
 z <- rnorm(20) + atan2(x,y)
 plot3d(x, y, z, col=rainbow(20))

The key here is calling open3d before the second plot to open a new "device"

Tags:

Plot

R

Rgl