【问题标题】:fig.width and fig.height not working for knitr Word output from R Markdownfig.width 和 fig.height 不适用于 R Markdown 的 knitr Word 输出
【发布时间】:2016-10-17 00:35:24
【问题描述】:

对于 pdf 图形,fig.width 和 fig.height 块选项只会改变我的 word 文档中 2"x2" 图形的比例。我似乎无法控制 pdf 图形的大小,因为我可以使用从 R Markdown 编织成 word 文档的 png 图形。

---
title: "Controlling PDF figure size in MS Word output"
output: word_document
---

```{r global_options, include=FALSE}
knitr::opts_chunk$set(fig.path='02_Figs/',  fig.show='asis', dev = 'pdf', 
include=FALSE, warning=FALSE, message=FALSE)
```

# Fig. 1. Small Plot
```{r include=TRUE, echo=FALSE, fig.width=2, fig.height=3, fig.keep='high'}
with(mtcars, plot(mpg~wt))
```

# Fig. 2. Big Plot
```{r include=TRUE, echo=FALSE, fig.width=4, fig.height=6, fig.keep='high'}
with(mtcars, plot(mpg~wt))
```

【问题讨论】:

    标签: r markdown rstudio knitr


    【解决方案1】:

    更新到最新版本的 Pandoc 1.17.1 解决了这个问题。现在pdf图像显示正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-11
      • 2020-10-23
      • 1970-01-01
      • 2014-09-10
      • 1970-01-01
      • 2013-09-28
      • 1970-01-01
      相关资源
      最近更新 更多