【问题标题】:Rstudio pdf export imported in Inkscape [duplicate]在 Inkscape 中导入的 Rstudio pdf 导出 [重复]
【发布时间】:2016-06-06 16:10:00
【问题描述】:

我正在尝试使用各种方法导出 ggplot 生成的图形的 pdf,以便在 Inkscape 中进行后处理:ggsave()、pdf()、dev.copy2pdf() 和通过 GUI 导出的 Rstudio(3x3 大小)。

library(ggplot2)

df <- data.frame(x = seq(1,10,1),
                 y = seq(1,10,1),
                 y.err = rep(1,10))

p<- ggplot(df, aes(x = x, y = y))+
  geom_errorbar(aes(ymin = y - y.err, ymax = y + y.err))+
  geom_point(size = 3, shape = 21, fill = "white")

ggsave(p, file = "ggsave.pdf", width = 3, height = 3)

pdf(file = "pdf.pdf", width = 3, height = 3)
p
dev.off()

p

dev.copy2pdf(file = "dev.copy2pdf.pdf", width = 3, height = 3)

所有 pdf 文件在 Adob​​e Reader 中看起来都相似,但 GUI 生成的文件稍大一些(5.2 kb 对 4.8 kb)。 Screenshot-1

但是当导入到 Inkscape 时,三个非 GUI 生成的图具有较小半径和未对齐的数据点的圆圈(请参阅 Screenshot-2)。

有人知道我在 pdf 导出命令中缺少哪些参数以在 Inkscape 导入中获得相同的结果吗?谢谢

附加信息:

  • 操作系统 Windows 10

  • Rstudio 0.99.441

  • R 3.2.4

  • Inkscape 0.91

[更新 1] 。将 Rstudio 更新为 0.99.902; R 到 3.3.0。同样的问题。

[解决方案] 在任何 pdf 导出命令中添加 useDingbats = F 即可解决问题(取自 Why doesn't Inkscape correctly read PDF files generated by R?

【问题讨论】:

  • 我认为至少,我们需要操作系统信息、R & Rstudio 版本等。
  • 我无法在 ubuntu 14.04、R 3.3.0、ggplot 2.0 上复制
  • 感谢 cmets,在问题中添加了附加信息
  • 可能是字体嵌入问题。您可以尝试在文件上运行 grDevices::embedFonts 看看是否有帮助。
  • 谢谢,确实是字体问题,用这个帖子解决了:stackoverflow.com/questions/23524262/…

标签: r pdf ggplot2 inkscape export-to-pdf


【解决方案1】:

在任何 pdf 导出命令中添加 useDingbats = F 即可解决问题(取自 Why doesn't Inkscape correctly read PDF files generated by R?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-25
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 2020-07-05
    • 2018-03-03
    • 1970-01-01
    相关资源
    最近更新 更多