Re: [R] Graphics 'snapshots' in Linux?

From: Marc Schwartz (via MN) <>
Date: Fri 16 Sep 2005 - 02:31:16 EST

On Thu, 2005-09-15 at 10:43 -0400, Tyler Smith wrote:
> Hi,
> I'm working on a MEPIS (Debian-based Linux) computer, using the
> emacs/ESS package to do my R work. I've got some plots that I label
> interactively using the locate function. With the Windows GUI there is
> an option to take a snapshot of the graphics output, saving it as an
> image file. Is there a way to do this with emacs/ESS?
> Thanks,
> Tyler


Take a look at ?dev.copy2eps and on the same page dev.copy(), which enable you to copy the current X11 plot supported output devices.

You could do something like the following for an EPS file:

text(locator(1), "Place Text Here")
dev.copy2eps(file = "MyPlot.eps")

or the following for a PNG file:

par(bg = "white")
text(locator(1), "Place Text Here")
dev.copy(device = png, file = "MyPlot.png")

Note that in the first example, is not required, as the EPS output device is closed after the call.

Also, note in the second example, you will need to set the background to white (unless already specified for whatever color you may be using), as the default output file will have a transparent background, even though the png() function shows the default as white. If my memory is correct this is because the X11 device itself has a transparent background by default and this is what is copied.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide! Received on Wed Sep 21 03:11:13 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:29:03 EST