I've provided a small reproducible example below. I would like to generate tabs in quarto for each of the ggplot objects within a named list plots
. The below quarto document would render the figures in their own 2nd level heading, but not in tabs as expected.
---
title: "Untitled"
format: html
---
```{r}
library(tidyverse)
data <- iris %>% as_tibble()
plots <- data %>%
group_nest(Species) %>%
deframe() %>%
map(., ~ {
ggplot(.x, aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point()
})
```
# Iris Plots
::: {.panel-tabset}
```{r}
#| column: screen
#| fig-width: 12
#| fig-height: 8
#| fig-align: center
#| results: asis
iwalk(plots, ~ {
cat('## ', .y, '\n\n')
print(.x)
cat('\n\n')
})
```
:::
The document would correctly render the plots within tabs as expected when the chunk-options (all except results:asis) were removed.
# Iris Plots
::: {.panel-tabset}
```{r}
#| results: asis
iwalk(plots, ~ {
cat('## ', .y, '\n\n')
print(.x)
cat('\n\n')
})
```
:::