[R] X11 graphics windows under CMD BATCH

Dirk Eddelbuettel edd at debian.org
Sun Oct 28 15:49:18 CET 2007

Hi Luke,

On 28 October 2007 at 14:30, Luke Spadavecchia wrote:
| Hi Dirk,
| Thanks for your useful advice, although I am not sure I fully  
| understand your response.
| I am able to open x11 windows from R CMD BATCH both in windows  
| XP,MAC  OS X and Linux (on various machines I use), providing the  
| relevant Sys.setenv() commands are in the script I call prior to  
| plotting commands. My problem is that the X11 windows only persist as  
| long as the script is running, and disappear when R exits - which is  
| very rapid for most plots (it is only when the script imports a  
| shapefile using maptools or something like that that the window is  
| open long enough to really examine the plot).
| Is there a way when running R (from batch mode or otherwise) of  
| 'saving' X11 windows, and keeping them open after the R session is  
| complete? I don't really want to write the graphics to file, because  
| the repeated calls from the Fortran code would overwrite each other,  
| and the idea is to do rapid appraisal of the simulated annealing  
| schedule, to check that mixing/cooling are progressing in an  
| efficient and  useful manner. Would using cairo (which I can't seem  
| to get to work at the moment) allow me to do this? I'm not sure it's  
| an x11 problem, but rather something to do with the way that R and  
| X11 communicate?

Seems I misunderstood your question at first. From what you say now, it seems
that you need other ways of keeping x11() output up even though the
computation and script that created them has finished.  One simple way is a
'wait for keyboard input' at the end of your script; a somewhat better way
would be to use real GUI -- the tcltk or gWidgets packages come to mind.

Hope this helps, Dirk

Three out of two people have difficulties with fractions.

More information about the R-help mailing list