如何在r降价和预订中的图形标题下方创建图形注释

问题描述 投票:1回答:1

我正在努力在r markdownbookdown中的图形标题下方创建图形注释。我想要的图形注释如下所示。该图来自(Greenstone and Hanna 2014)。我的身材实际上是r图。注释的长度应与图形宽度相同,并自动折行。有任何想法吗?

enter image description here

r r-markdown bookdown
1个回答
0
投票

如果您使用的是通过LaTeX传输的格式(例如pdf_bookpdf_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.
© www.soinside.com 2019 - 2024. All rights reserved.