我在 Windows 7 中使用 RStudio/knitr/markdown/pandoc/docx。当我并排打印其中两个时,我无法在我的图上获取标题。
在下面的示例中,我的 docx 中没有中间图形的标题。不过,最后一张图中的数字是正确的。
顺便说一句,当我不包含 fig.subcap 选项时,我也没有得到标题。
谢谢!
Title
========================================================
```{r setup, include=FALSE}
opts_chunk$set(comment=NA)
fig.caption.num = local({
i = 0
function(x) {
i <<- i + 1
paste('Fig. ', i, ': ', x, sep = '')
}
})
```
Some text:
```{r fig.width=7, fig.height=6, fig.cap=fig.caption.num('My first plot')}
plot(cars)
```
Two plots:
```{r fig.width=3, fig.height=7, fig.cap=fig.caption.num('Two plots'), fig.show='hold', fig.subcap=c('one plot', 'the other one')}
plot(cars)
plot(1:10)
```
Some more text:
```{r fig.width=7, fig.height=7, fig.cap=fig.caption.num('My last plot')}
plot(cars)
```
Finish text
sessionInfo()
R 版本 2.15.3 (2013-03-01) 平台:x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Spanish_Argentina.1252 LC_CTYPE=Spanish_Argentina.1252
[3] LC_MONETARY=Spanish_Argentina.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Argentina.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.4.3 formatR_0.7 knitr_1.2 stringr_0.6.2
[6] tools_2.15.3