如何在 r markdown 和 bookdown 中的图形标题下方创建图形注释
How to create a figure note below the figure caption in r markdown and bookdown
我正在努力在 r markdown
和 bookdown
中的图形标题下方创建图形注释。我想要的图形注释如下所示。此图来自(Greenstone and Hanna 2014)
。我的身材其实是一个
r
剧情。注释的长度应与图形宽度相同,并自动换行。有什么想法吗???
如果您使用的是通过 LaTeX 的格式(例如 pdf_book
或 pdf_document
),这是可能的。我不知道是否有办法用 HTML 输出来做到这一点。 (但这会移动图形吗?也许图形下方的纯文本就足够了)。这个想法是输入 LaTeX 代码到
自己开始和结束图形,并将注释包含在该块中。这是一个基于标准 pdf_document
示例的示例。
---
title: "Untitled"
output:
pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Including Plots
You can also embed plots, for example: Figure \ref{fig:pressure}.
```{=latex}
\begin{figure}[t]
```
```{r pressure, echo=FALSE}
plot(pressure)
```
```{=latex}
\caption{Air quality monitors across India. \label{fig:pressure}}
\textit{Notes:} Dots denote cities with monitoring stations
under India's National Ambient Air Monitoring Programme
(NAAMP). Geographical data are drawn from MIT's Geodata
Repository.
\end{figure}
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
我正在努力在 r markdown
和 bookdown
中的图形标题下方创建图形注释。我想要的图形注释如下所示。此图来自(Greenstone and Hanna 2014)
。我的身材其实是一个
r
剧情。注释的长度应与图形宽度相同,并自动换行。有什么想法吗???
如果您使用的是通过 LaTeX 的格式(例如 pdf_book
或 pdf_document
),这是可能的。我不知道是否有办法用 HTML 输出来做到这一点。 (但这会移动图形吗?也许图形下方的纯文本就足够了)。这个想法是输入 LaTeX 代码到
自己开始和结束图形,并将注释包含在该块中。这是一个基于标准 pdf_document
示例的示例。
---
title: "Untitled"
output:
pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Including Plots
You can also embed plots, for example: Figure \ref{fig:pressure}.
```{=latex}
\begin{figure}[t]
```
```{r pressure, echo=FALSE}
plot(pressure)
```
```{=latex}
\caption{Air quality monitors across India. \label{fig:pressure}}
\textit{Notes:} Dots denote cities with monitoring stations
under India's National Ambient Air Monitoring Programme
(NAAMP). Geographical data are drawn from MIT's Geodata
Repository.
\end{figure}
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.