[R] Graphics after invoking R from the command line

Duncan Murdoch murdoch at stats.uwo.ca
Wed Nov 28 18:35:20 CET 2007


On 11/28/2007 12:05 PM, Mithun Jacob wrote:
> I've tried running graphics commands like plot by invoking R at the
> command line but the graphics window does not appear. I'm using
> R-2.6.0 on Windows XP and am using the cmd shell. Here's a sample
> session:
> 
> R --slave --save --file=-
> x<-c(1,2,3,4)
> plot(x,x)
> 
> This leads to nothing. I've found a way around it, but the graph
> window is frozen and commands to it have to be sent twice for the data
> to appear.
> 
> R --slave --save --file=-
> x<-c(1,2,3,4)
> windows()
> plot(x,x)
> plot(x,x)
> 
> Am I doing something wrong here? It would be nice if I could display a
> graphics window which isn't frozen.

Do you really need to run R --slave?  R is assuming it is running 
non-interactively, and won't leave any time free to handle events and 
update the window.  If you just used "R" or "Rterm" as your command, 
you'd get an interactive command-line version of R running, and 
everything should work.

Duncan Murdoch



More information about the R-help mailing list