0

I have an Rmd script with multiple figures per chunk. I would like to reference each figure when commenting them. What is the syntax for calling each separate figure?

I started with one figure per chunk, which worked:

---
title: "chaos downcute html - one figure"
output:
  rmdformats::downcute:
    downcute_theme: "chaos"
    use_bookdown: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

I would like referring to Figure \@ref(fig:pressure).

```{r pressure, fig.cap= "The pressure data", echo = FALSE}
plot(pressure)
```

Test with one figure

Then I tried with two plots by adding the 1 and 2 index in \@ref(fig:pressure), but it failed:

---
title: "chaos downcute html - two figures"
output:
  rmdformats::downcute:
    downcute_theme: "chaos"
    use_bookdown: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

I would like referring to Figure \@ref(fig:pressure1) and Figure \@ref(fig:pressure2) .

```{r pressure, fig.cap= c("The pressure data", "Empty plot"), echo = FALSE}
plot(pressure)
plot(0)
```

Test with two figures Two question marks (??) appear instead of the link.

Adding fig.show = 'hold' in the chunk header did not work either.

Same issue with the standard output bookdown::html_document2: default

fpantin
  • 3
  • 3

0 Answers0