gpt4 book ai didi

r - fig.width 和 fig.height 不适用于 R Markdown 的 knitr Word 输出

转载 作者:行者123 更新时间:2023-12-03 15:00:01 24 4
gpt4 key购买 nike

对于 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))
```

最佳答案

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

关于r - fig.width 和 fig.height 不适用于 R Markdown 的 knitr Word 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37843160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com