【问题标题】:Export plot with high quality from R to Word [duplicate]将高质量的绘图从 R 导出到 Word [重复]
【发布时间】:2015-03-21 05:33:02
【问题描述】:

我在 R & 中做了一个情节,我想在情节中定义一些格式问题,但我没有。

  1. 是否可以定义绘图的大小?如何?
  2. 我想更改 Times New Roman 的字体系列。可能吗?
  3. 如何将绘图以高质量导出到 Word。我尝试了 tiff,但情节并不好。

【问题讨论】:

标签: r export-to-word


【解决方案1】:

您可以使用ReporteRs 包将绘图导出到 Word。请参阅以下示例 - 它将生成一个 .docx 文件,其中包含具有定义大小的 矢量图形 格式(高质量)的可编辑图形。

library( ggplot2 )
library( ReporteRs )
doc = docx( )

myplot = qplot(Sepal.Length, Petal.Length, data = iris
  , color = Species, size = Petal.Width, alpha = I(0.7) )

doc = addPlot( doc = doc, fun = print, x = myplot, 
  vector.graphic = T, # vector graphic instruction
  fontname = "Times New Roman",  # font specification
  width = 4, height = 4 #dim. are in inches
  )

writeDoc( doc, file = "test.docx" )

【讨论】:

  • 感谢您的帮助!其他问题。 ggplot2 包比 R 的简单“情节”更好?
  • 库(ReporteRs)不存在???
  • 是的,已经不存在了。改用官员
猜你喜欢
  • 2019-07-11
  • 1970-01-01
  • 2013-02-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-10
  • 2021-10-31
  • 1970-01-01
相关资源
最近更新 更多