zku*_*rtz 8 .emf knitr r-markdown
当使用rmarkdown与knitr在Rstudio编织一个Microsoft Word文档,图形通常看起来糟糕,因为通常的矢量图形格式,如PDF不是在Microsoft Word中支持.
幸运的是,devEMFR中的软件包生成了微软矢量格式EMF,我几乎可以将它用于我的rmarkdown应用程序.问题是我的图像显示得太小了.如何控制图像尺寸?
我试过以下标准的东西:
---
title: "Plot size trouble demo"
author: "for stackoverflow"
output: word_document
---
Here I include graphics in a word document using the `emf` printing device.
```{r dev = 'emf', fig.ext = 'emf'}
require(devEMF)
plot(1:10, 1:10)
```
The plot is small, so I try to make it bigger with the `fig.height` and fig.width` options:
```{r dev='emf', fig.ext='emf', fig.height=10, fig.width=10}
require(devEMF)
plot(1:10, 1:10)
```
The plot region stayed the same size, and now I have super-small labels and points!
Finally, I try to use the `out.width` and `out.height` options to rescale the figure to a different size, but this produces nothing at all:
```{r dev='emf', fig.ext='emf', fig.height=10, fig.width=10, out.width = '5in', out.height= '5in'}
require(devEMF)
plot(1:10, 1:10)
```
Run Code Online (Sandbox Code Playgroud)
更新: 我注意到这里是rmarkdown支持win.metafile,但下面也产生什么:
```{r dev = 'win.metafile', out.width = '5in', out.height= '5in'}
plot(1:10, 1:10)
```
Run Code Online (Sandbox Code Playgroud)