Re: [R] Creating images without X11

2010-03-14 Thread Mario Valle

Is it possible the problem is another?
I cannot generate png images when R runs on a machine without 
*installed* X11


Here is the error message when I submit a simple png() plot on a 
computing node of my cluster.


Error in X11(paste(png::, filename, sep = ), width, height, 
pointsize,  :

  unable to start device PNG
Calls: png
In addition: Warning message:
In png(Test.png) : unable to open connection to X11 display ''
Execution halted

The solution for my problem is to generate pdf files (that are then 
included in a LaTeX paper, so the solution does not help you).


Ciao!
mario

On 14-Mar-10 6:14, Sharpie wrote:



Jillian E Kozyra 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?

Thanks,
JIllian




I had this exact same problem last summer when attempting to set up an
automated process involving image generation on a remote server.  Since I
didn't have admin rights to the server, I ended up switching to the Cairo
package for image generation as it uses the Cairo library rather than X11 as
the back end.

The other solution involved setting some sort of obscure, arcane X11
permission that I can't recall right now.  All I can recall is that finding
it was a frustrating half-day of Google searching and digging through man
pages.

I would suggest Cairo.

Hope this helps!

-Charlie

-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University


--
Ing. Mario Valle
Data Analysis and Visualization Group| 
http://www.cscs.ch/~mvalle

Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

__
R-help@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.


Re: [R] Creating images without X11

2010-03-14 Thread Barry Rowlingson
On Sun, Mar 14, 2010 at 5:14 AM, Sharpie ch...@sharpsteen.net wrote:

 I had this exact same problem last summer when attempting to set up an
 automated process involving image generation on a remote server.  Since I
 didn't have admin rights to the server, I ended up switching to the Cairo
 package for image generation as it uses the Cairo library rather than X11 as
 the back end.

 The other solution involved setting some sort of obscure, arcane X11
 permission that I can't recall right now.  All I can recall is that finding
 it was a frustrating half-day of Google searching and digging through man
 pages.

 It should be that 'cairo' is the default type for png (and other
bitmap) generation:

 getOption(bitmapType)
[1] cairo

 The png() function has an option for 'type='. If you use type=cairo
(which is got from getOption, should be default) then an X server
isn't needed. If you try type=X11 then one is. Apple fanboys can try
type=quartz.

 Again, this is all convoluted with what was compiled into R, and what
does capabilities() etc tell us.

 No word back from the original poster yet - Jillian Kozyra, are we helping???

Barry

__
R-help@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.


Re: [R] Creating images without X11

2010-03-13 Thread michael watson (IAH-C)
library(GDD) 

Or install Xvfb on your server

From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
Jillian E Kozyra [jill...@gmail.com]
Sent: 13 March 2010 16:27
To: r-help@r-project.org
Subject: [R] Creating images without X11

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?

Thanks,
JIllian

--
917-434-7511
http://www.jilliankozyra.com

__
R-help@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.

__
R-help@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.


Re: [R] Creating images without X11

2010-03-13 Thread Ted Harding
On 13-Mar-10 16:27:05, Jillian E Kozyra 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?
 
 Thanks,
 JIllian
 -- 
 917-434-7511
 http://www.jilliankozyra.com

Provided you trust your code to produce correctly the graphic you
want (i.e. you do not need to inspect the graphic on-screen to
verify that it is correct), then there should be no problem.
As a test, I just switched (Ctrl-Alt-F1) to a text console in
Linux, and then executed

  R --no-save
  png(MyPNG.png)
  plot(rnorm(10),rnorm(10))
  dev.off()

Then I killed R, switched back (Ctrl-Alt-F7) to the graphical
desktop, and then found the file MyPNG.png safe and well which,
when displayed, was just what it should be.

Summary: So long as you do not try to plot graphics to screen,
and use the png() or jpg() device (as above), then the graphic
will be written to file without needing X11. However, you will
not, of course, be able to see them on screen. If you just did
the plot() command without encapsulating it in a device to
write files as above, then nothing would happen.

It is possible to convert a graphics file into ASCII Art,
and then you could see a (very) coarse approximation to your
graphic on-screen in a console terminal. However, I'm not
going to make any recommendations on how to do that!

Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 13-Mar-10   Time: 22:16:16
-- XFMail --

__
R-help@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.


Re: [R] Creating images without X11

2010-03-13 Thread Barry Rowlingson
On Sat, Mar 13, 2010 at 4:27 PM, Jillian E Kozyra jill...@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

__
R-help@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.


Re: [R] Creating images without X11

2010-03-13 Thread Ted Harding
On 13-Mar-10 22:17:26, Barry Rowlingson wrote:
 On Sat, Mar 13, 2010 at 4:27 PM, Jillian E Kozyra jill...@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.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 13-Mar-10   Time: 22:36:15
-- XFMail --

__
R-help@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.


Re: [R] Creating images without X11

2010-03-13 Thread Sharpie


Jillian E Kozyra 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?
 
 Thanks,
 JIllian
 
 

I had this exact same problem last summer when attempting to set up an
automated process involving image generation on a remote server.  Since I
didn't have admin rights to the server, I ended up switching to the Cairo
package for image generation as it uses the Cairo library rather than X11 as
the back end.

The other solution involved setting some sort of obscure, arcane X11
permission that I can't recall right now.  All I can recall is that finding
it was a frustrating half-day of Google searching and digging through man
pages.

I would suggest Cairo.

Hope this helps!

-Charlie

-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://n4.nabble.com/Creating-images-without-X11-tp1592016p1592201.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.