[R] Creating images without X11

(Ted Harding) Ted.Harding at manchester.ac.uk
Sat Mar 13 23:36:20 CET 2010


On 13-Mar-10 22:17:26, Barry Rowlingson wrote:
> On Sat, Mar 13, 2010 at 4:27 PM, Jillian E Kozyra <jillyh0 at gmail.com>
> wrote:
>> Dear Colleagues,
>>
>> We are attempting to create trees using R with our Ruby on Rails
>> application. However, we are running into a problem involving the
>> creation of the graphic. We would like them to be in either jpg or png
>> format so that users can save, but due to a lack of control over our
>> sever we are unable to start X11 server. Is there a way to create
>> these images without using X11 server?
>>
> 
>  Not sure what version of R you are using, but the png() device hasn't
> needed an X11 server since way back when. Watch:
> 
> $ export -n DISPLAY
> $ R
>  > png()
>  > plot(1:10)
>  > dev.off()
>  > q()
> 
> then I have a very fine Rplot001.png file.
> 
>  Now it may be that you can't compile PNG support without X11 being
> there at compile time, but if you can compile R on a workstation with
> X11 support then that R should work find on your server to produce
> pngs even without X11 support there and then.
> 
>  jpeg() device works the same - X11 not needed at runtime.
> 
>  What makes you think it's lack of X11 that is making png or jpeg
> devices fail? Run the capabilities() function and see if your R has
> png and jpeg support - my suspicion is that you've compiled it on the
> server with no X11 headers. It doesn't need a server at runtime.
> 
> Barry

[Not for the first time, we've made almost identical comments
almost simultaneously, Baz]

A further thought: Jillian, I was assuming from your first post
that you were unable to start X11 on the machine you were sitting
at, the server being remote.

If you *can* start X11 on the machine you are sitting at (or if
it boots up into a graphics display with X11 already running)
then you do not need to have X11 running on the remote server,
so long as it has X11 *installed* (so that the programs which
need an X display are there).

It's a reversal of the usual view of things. If your machine
is running X, then it is *your* machine which is the *X-server*,
and programs running on the remote server which generate X11
output are the *X-clients*, sending X-requests to your machine.

The one thing you may need to do on the machine you are sitting
at is

  xhost +

to allow access to your local X-server by remote machines which
are generating X output.

In short -- I'm not sure in my mind about the situation you find
yourself in. How does it come about that you are "unable to start
X11 server"?

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 13-Mar-10                                       Time: 22:36:15
------------------------------ XFMail ------------------------------



More information about the R-help mailing list