r - 一个 block 中有多个图的图标题

标签 r latex r-markdown knitr

我这样标记我的数字。

---
title: "xxx"
output: 
  pdf_document:
    fig_caption: true
---

然后在每个块中
```{r, fig.cap="some caption"}
qplot(1:5)
```

这很好用。但是,在我在循环中绘制多个图形的块中,我无法指定标题。这根本不会产生任何标题:
```{r, fig.cap="another caption"}
qplot(1:5)
qplot(6:10)
```

如何指定一个与每个图的第一个块相同的数字?

最佳答案

您可以使用长度为 2(或循环大小)的 fig.cap 参数:

```{r, fig.cap=c("another caption", "and yet an other")}
qplot(1:5)
qplot(6:10)
```

关于r - 一个 block 中有多个图的图标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41230299/

相关文章:

r - ggplot2 geom_violin,方差为 0

r - 如何将 LaTeX 包与 R/exams 一起使用?

r - 编织xtable : how to position tables between text?

r - Sweave:将 R 的输出解释为 LaTeX 代码

r - 将参数传递给 R Markdown

latex - 使用knitr kable制作居中的LaTeX表格

r - Foreach combine error, rbind all variables should have the same length...但他们这样做 [R]

r - curve3d 找不到本地函数 "fn"

r - 从数据框列中提取所有百分比数字

r - 生成动态 R Markdown block