Add both a title above and a note below a figure when knitting Rmarkdown to HTML

Viewed 148

I am knitting an Rmarkdown document to HTML with bookdown::html_document2. How can I include both a title above the figure and a note below the figure?

For example, this code lets me produce a figure with a title above the figure. But how can I also include a note below the figure?

To be clear, I do not want to include the note below the ggplot with + labs(caption = "Text"), I want to have the note in the same HTML style as the figure title above the figure.

---
title: "Reprex"
output: 
  bookdown::html_document2
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(fig.topcaption = TRUE) # Display figure title above the figure
```

Figure \@ref(fig:figure) shows some results.

```{r figure, fig.cap="Figure Title (which I want above the figure)"}
library(tidyverse)
mtcars %>% 
  ggplot() +
  aes(x = wt, y = mpg) +
  geom_point()
```
0 Answers
Related