I really like littler is really great for scripting using R. But i don't how to use external graphics device a la gnuplot (for example using Octave). I'm able to produce the desired graph but i have to use Sys.sleep and i don't want to do so, because i want to close it my self in an interactive way or better continue the script without closing the device.
So far this is what my code looks like :
#!/usr/bin/env r -t
suppressMessages(require(Cairo))
CairoX11()
plot(rnorm(1000), pch = 19)
Sys.sleep(50)
# some code without closing the graphics window
My question is : Do you know a way to achieve that ?
Any hint, document, link or code will be appreciated
Besides John's suggestion, you could be explicit and invoke one of the GUI packages to bring up a new 'frame' (or 'window') that then shows the plot. That will remain on-screen until the user (or an external event) terminates that window.
The tcltk package can be used along with the tkrplot package; this is the most portable. RGtk2 is more modern but harder to install / use on Windows as Gtk2 is not exactly native there. There is more---search for R GUIs here and on other places on the intertubes.
I don't know of a way to do that, since these are purposely non-interactive ways of running R. I would just run your script in an interactive R session with par(ask=T)
. That way it'll pause for the user between figures, like the demos in the R documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With