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
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:
plot(1:5)
text(locator(1), "Place Text Here")
dev.copy2eps(file = "MyPlot.eps")
or the following for a PNG file:
par(bg = "white")
plot(1:5)
text(locator(1), "Place Text Here")
dev.copy(device = png, file = "MyPlot.png")
dev.off()
Note that in the first example, dev.off() 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