[Rd] Re: Producing PNG on Debian Linux (was the false bug report, Re: [Rd] png output requires X connection (PR#1165))

Prof Brian D Ripley ripley@stats.ox.ac.uk
Sun, 18 Nov 2001 13:56:17 +0000 (GMT)


On Sun, 18 Nov 2001, Dirk Eddelbuettel wrote:

>
>   "Brian" == Brian D Ripley <Prof> writes:
>   Brian> On all my systems (Linux, Solaris, Windows)
>   Brian>
>   >> bitmap("test.png") plot(1:10) graphics.off()
>   Brian>  gives `sharp and clear' output.  I am using up-to-date GhostScript
>   Brian> (7.00 or 6.51): perhaps *this* is the bug that needs to reported to
>   Brian> Debian?
>   Brian>
>   >> I agree it would be nice if the PNG output was not directly tied to the
>   >> GUI but there are plenty of ways to get around the problem.
>   Brian>  I seem to have to keep saying this!  PNG output is *not* `directly
>   Brian> tied to the GUI'.  On Unix-alikes, one of the two devices I provided
>   Brian> for you is, and only one.
>
> How about clarifying the documenation in unix/png.Rd then?  A suggestion is
> below (against my R-1.3.1 sources, don't have R-devel here).

Already done in R-devel:

     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 will not be available
     if R has been started with `--gui=none' (and will give a different
     error message), and they may not be usable unless the X11 display
     is available to the owner of the R process.
...

See Also:

     `Devices', `dev.print'

     `capabilities' to see if these devices are supported by this build
     of R.

     `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.

NB: on our servers there is an X11 display available to cron jobs.


>
> Dirk
>
> edd@sonny:~/debian> diff -u r-base-1.3.1/src/library/base/man/unix/png.Rd{.orig,}
> --- r-base-1.3.1/src/library/base/man/unix/png.Rd.orig  Sun Nov 18 07:28:46 2001+++ r-base-1.3.1/src/library/base/man/unix/png.Rd       Sun Nov 18 07:33:55 2001@@ -47,6 +47,11 @@
>    These are based on the \code{\link{X11}} device, so the additional
>    arguments to that device work, but are rarely appropriate.  The
>    colour handling will be that of the \code{X11} device in use.
> +
> +  Consequently, use of these functions requires an \code{X11} terminal
> +  which is not available in non-interactive sessions such as those started
> +  by cron(8) or at(1). The \code{\link{bitmap}} function can be used in
> +  those cases to create PNG or JPEG files.
>  }
>  \author{Guido Masarotto and Brian Ripley}
>
> @@ -59,5 +64,9 @@
>  \examples{
>  ## copy current plot to a PNG file
>  \dontrun{dev.print(png, file="myplot.png", width=480, height=480)}
> +## use bitmap() to create a PNG file
> +\dontrun{bitmap("/tmp/test.png")}
> +\dontrun{plot(1:10,main="Straight line")}
> +\dontrun{graphics.off()}
>  }
>  \keyword{device}
>
> --
> Better to have an approximate answer to the right question
> than a precise answer to the wrong question. -- John Tukey
>

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._