如何将EPS数字中的文本转换为R中的矢量轮廓?

时间:2016-02-23 13:02:09

标签: r

我正在准备一份提交给期刊的论文,该期刊要求以EPS格式提交矢量图形,并将图中的所有文本转换为轮廓。将文本转换为矢量轮廓有助于避免最终布局中的字体问题。期刊要求可用here

可以使用ggplot2

轻松在R中创建EPS数据
library(ggplot2)
ggsave(filename = "file.eps")

或使用setEPS()postscript设备,如前所述here

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

我的问题是:如何将数字中的文本转换为矢量轮廓?我在其他软件(例如Illustrator或InDesign)中找到了有关如何执行此操作的信息,但我想知道是否有办法直接在R中执行此操作。

1 个答案:

答案 0 :(得分:1)

使用您的发行版软件包管理器安装ghostscript如果您使用的是Linux或download it for windows(还有portable version),对于mac,您可能use brew。然后从R like in this SO question内调用gsgs.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"))