Another way is to use Cairographics-based SVG, PDF and PostScript Graphics Devices.
This way you don't need to setEPS()
cairo_ps("image.eps")
plot(1, 10)
dev.off()
Yes, open a postscript()
device with a filename ending in .eps
, do your plot(s) and call dev.off()
.
If you are using ggplot2
to generate a figure, then a ggsave(file="name.eps")
will also work.
The postscript()
device allows creation of EPS, but only if you change some of the default values. Read ?postscript
for the details.
Here is an example:
postscript("foo.eps", horizontal = FALSE, onefile = FALSE, paper = "special")
plot(1:10)
dev.off()
Source: Stackoverflow.com