Re: [R] R graphics with Linux (libpng)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 11 Jan 2007 - 18:26:44 GMT

On Thu, 11 Jan 2007, Rebecca Tagett wrote:

> Hello,
>
> I'm trying to adapt some R code that works on Windows so that it will work
> on a Linux machine.
>
> The command :
>
> png("myFile.png", width=600, height=600)
>
> fails claiming that it is impossible to establish a connection with X11.
> (Error messages are in French, so I'm not pasting them here!)
>
>
>
> I have libpng installed:
>
>> rpm -qa libpng*
>
> libpng-1.0.12-2
>
> libpng-devel-1.0.12-2
>
>
>
> So I don't understand why R thinks I'm trying to connect to X11. I haven't
> been able to find many examples of R graphics code specifically for Linux,
> but I have the impression that if libpng is installed, the graphics commands
> are identical. The libpng manual is not useful, because it does not mention
> use of libpng commands in an R environment.

?png says

      R can be compiled without support for either or both of these
      devices: this will be reported if you attempt to use them on a
      system where they are not supported.  They may not be usable
      unless the X11 display is available to the owner of the R process.

Note:

      These are based on the 'X11' device, so the additional arguments
      to that device work, but are rarely appropriate.  The colour
      handling will be that of the 'X11' device in use.

      'bitmap' provides an alternative way to generate PNG and JPEG
      plots that does not depend on accessing the X11 display but does
      depend on having GhostScript installed.  (Device 'GDD' in CRAN
      package 'GDD' is another alternative using several other
      additional pieces of software.)

so the help page seems quite specific about the connection to X11.

> I'm using R 2.4.1, which I recently installed. Do I have to install a more
> recent libpng ? If so, do I have to reconfigure and remake R ?

The libpng is very old, but even more likely is that libz is too old. There were messages when you configured: did you read them at all? If not, plese do rebuild R and read them this time. Without the exact error message I cannot be sure, but I don't think this is the problem.

> I've also read that no graphics devices are available under R CMD BATCH.
> Does that really mean that I can't create graphics from some R code that I
> launch in noninteractive mode?

Your source is incorrect: please advise the author(s) to correct it.

> Thanks in advance !
>
> Rebecca Tagett
>
> [[alternative HTML version deleted]]

Did you also read that you are asked not to send HTML mail? (That is from a reliable source.)

>
> ______________________________________________
> R-help@stat.math.ethz.ch 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@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

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Fri Jan 12 05:37:43 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 16 Jan 2007 - 09:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.