I am struggling to create a figure note below the figure caption in r markdown
and bookdown
. The figure note I want looks like below. This figure is from (Greenstone and Hanna 2014)
. My figure actually is a
r
plot. The note should be the same length as the figure width and automatically break the line. Any ideas???
If you are using a format that goes through LaTeX (e.g. pdf_book
or pdf_document
), this is possible. I don't know if there's a way to do it with HTML output. (But does that move figures around? Maybe plain text below the figure is enough). The idea is to enter the LaTeX code to
start and end the figure yourself, and include the note within that block. Here's an example, based on the standard pdf_document
example.
---
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.