How to convert text in EPS graphics to vector outlines in R?


Lucas Weber

I'm preparing a paper for submission to a journal that requires vector graphics to be submitted in EPS format and all text in the graphics to be converted to outlines. Converting text to vector outlines helps avoid font issues in the final layout. Log requirements are available here .

EPS figures can be ggplot2easily created in R with :

library(ggplot2)
ggsave(filename = "file.eps")

Or use setEPS()and postscriptdevice, as described here :

setEPS()
postscript("filename.eps")
plot(1:10)
dev.off()

My question is: how can I convert the text in the figure to a vector outline? I've found information on how to do this in other software such as Illustrator or InDesign, but I'm wondering if it's possible to do this directly in R.

Akraf

ghostscriptIf you're on Linux, use your distribution's package manager to install it; if you're on Windows, you can use your distribution's package manager to download (this is also a portable version ); for Mac, you can usebrew . Then call from gsor from within R like in this SO question .gs.exe

library(ggplot2)
data(diamonds)

gs.cmd <- "gs"  # ghostscript executable
# gs.cmd <- "C:/path/to/gs.exe" # Windows

p <- qplot(x=carat, y=price, color=clarity, data=diamonds)

ggsave(p, filename="test.eps")

system(paste(gs.cmd,"-o test_outline.eps -dNoOutputFonts -sDEVICE=eps2write test.eps"))

Related