I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interacti
Here is an example script that works for me (tested your first calling method on windows). It uses the tcltk package and creates an extra, small window with a single button, the script will pause (but still allow you to interact with the rgl window) until you either click on the 'continue' button on press a key while that window is active, then continue with the script.
library(tcltk)
library(rgl)
mywait <- function() {
tt <- tktoplevel()
tkpack( tkbutton(tt, text='Continue', command=function()tkdestroy(tt)),
side='bottom')
tkbind(tt,'', function()tkdestroy(tt) )
tkwait.window(tt)
}
x <- rnorm(10)
y <- rnorm(10)
z <- rnorm(10)
plot3d(x,y,z)
mywait()
x <- rnorm(100)
y <- rnorm(100)
z <- rnorm(100)
plot3d(x,y,z)
mywait()
cor(x,y)