You run R in non-interactive mode - Rscript is for scripts, so the default build device is pdf() , not x11() , or something else by default for your OS ( windows() in appearance), however, itβs trivial to open an alternative device; use x11() or windows() . The problem that you are trying to write a script that will display a graph on the screen is that in the example code you showed, the script ends immediately after drawing the graph displayed on the screen or on the pdf() device. In the best case, you can pause it with using Sys.sleep() , for example:
x <- 1:10 y <- sin(x) x11() ## or windows() plot(x,y) Sys.sleep(10)
I think you are going wrong on this. If you want interactivity when you run R "script", by which I mean a set of R statements that do some analysis, you'd better get an editor / IDE on your OS that allows you to go through a script line or piece of code at a time, and also interact with the current session R. For this, I use Emacs and the ESS extension. You can consider Tinn-R or RStudio as alternatives.
Rscript designed to run scripts or batch jobs that do not need human interaction or intervention.
source share