Saturday, May 24, 2008

Save R Plot in EPS format

Here is a code example of how to save an R plot in EPS (instead of PS):
postscript(file="testplot.eps",
paper="special",
width=10,
height=10,
horizontal=FALSE)

yvalues = runif(50)
plot(yvalues)

dev.off()
The variation is adding paper="special" and horizontal=FALSE.

5 comments:

Anonymous said...

Nice and concise, cheers.

Anonymous said...

Thanks! for some reason I have having a really hard time finding a clear example of how to save an R plot to a file.

Unknown said...

> help("setEPS")

Marianne said...

Nice, many thanks for the useful post when I needed a quick example. setEPS() before the plot also works great to preset the right options for postscript() - thanks Ryan for the comment.

Anonymous said...

Thanks. It's really short and effective.