我在 R & 中做了一个情节我想在我的情节中定义一些格式问题,但我没有得到它。
- 是否可以定义情节的大小?如何?
- 我想更改 Times New Roman 的字体系列。可能吗?
- 它如何以高质量将绘图导出到 Word。我尝试了 tiff,但情节并不好。
我在 R & 中做了一个情节我想在我的情节中定义一些格式问题,但我没有得到它。
您可以使用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" )