[R] Displaying Grahics to the X Window when calling R from command line

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 16 09:11:52 CEST 2008


The issue is that the X11() device is the default device only in 
interactive use, and further than the event loop is only run in 
interactive use.

You need to

1) make use of R 2.7.0 RC
2) call R with R --vanilla --interactive
3) arrange for your script to wait for something so the plot remains up.

This has come up before, so please search the archives for more details.


On Tue, 15 Apr 2008, Pologruto, Thomas wrote:

> Hi,
>
> I am running an R script from the command line by calling:
>
>> R --vanilla < test.R
>
> My terminal is part of the Xwin (Xterm) and there is a plot(1:10)
> command in the test.R script.
>
> This will not produce a grahic though.

I think it does, on a PostScript or PDF file.

> When I start R by calling R then
> plotting from the R command in the same xterm, I do get a graphic
> display.
>
> How do I create a xwin plot by calling R from the command line?
>
> Any help is most appreciated.  I have preprocessed the data in perl and
> then feed it into my R script and want to see a plot on the screen.
>
> Thanks,
> Tom
>
> ==============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
>
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ==============================================================================
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list