Printing from X11 window (was: Re: [R] Working with R batch)

Prof Brian D Ripley ripley at
Thu Apr 6 17:29:28 CEST 2000

On Thu, 6 Apr 2000, Stuart Luppescu wrote:

> On 06-Apr-2000 Prof Brian D Ripley wrote:
> > If you want a hardcopy of the plot you can use any means you like, for
> > example to print an x11() device's window via your window manager, or use
> > dev2bitmap to grab the plot as a bitmap.  Basically for R _on Unix_ the
> > common format for printable plot files is PostScript, but there is also a
> > pictex device.  (A direct PDF device is at least a dream, and Windows has
> > other devices based on its GDI and producing bitmap formats such as PNG and
> > JPEG. No one has asked for a PCL (LaserJet) interface, which older programs
> > such as S-PLUS support.  People have talked about fig and similar formats
> > too.)
> I would really like to know how to do this. One thing (maybe the only thing) I
> miss about working with S-Plus is the ability label points interactively using
> identify() in X11() and then produce a postscript plot of the result for
> printing just by clicking on the ``PRINT'' button in the window. Prof. Ripley
> mentions printing the contents of the window using your window manager, but my
> window manager doesn't permit this. Dev2bitmap is not an option, as I need
> postscript. I like pictex, but I don't see how to output the contents of an X11
> window as pictex. Isn't there a way to do this?

First, you can do what the S-PLUS print button does by using dev.print, to
postscript() or pictex() devices. It should (now) pick up points added by
locator() or identify().  This does not (in either R or S-PLUS) save the
screen, but replay the graphics calls to another device.

Second, essentially shows you how to create a suitable call to dev.print to
copy the current screen. Just omit the piping to gs. We are currently
considering a new dev.print-like function which will get the x11 device
width, height etc and copy the x11 device to postscript (and thence to a

> (I'm running R 1.0.0 on RedHat Linux 6.2 (intel).)

Many X window managers allow you to grab a window as a bitmap. Mine's
called snapshot.  There are raw x11 tools too.

Brian D. Ripley,                  ripley at
Professor of Applied Statistics,
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-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at

More information about the R-help mailing list