Skip to content

Saving R graphics as encapsulated postscript files

July 17, 2012

Although there used to be, there is no longer support for an eps command that can be used to save R graphics as encapsulated postscript files. This SO entry shows what to do. The easiest approach to all this stuff is,


# 'tell' R that any subsequent calls to the postscript function
# should produce encapsulated postscript files (i.e. .eps files) 
setEPS()

# when actually calling postscript, it is usually necessary that the height 
# and width arguments are explicitly specified -- for some reason the 
# default here is WAY too small for any graphics i've ever created.
postscript('filename.eps', height = 8.5, width = 8.5)

# code for generating the graphics goes here
dev.off() 

Thank goodness for SO…this would have taken me a very long time to figure out.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: