I have a list with 100 plots which I want to automate via quarto such that each plot is produced in a new slide of a power point pressentation.
Here is a reproducible example of what I did:
title: “test-auto”
format: pptxlibrary(knitr) library(tidyverse)
plot_list_q <- list( ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point(), ggplot(mtcars, aes(x = hp, y = drat)) + geom_point() )
Slide creation function create_slide <- function(plot, index) { knit_expand(text = c( paste("## Plot", index), "", "```{r}", "plot_list_q[[{{index}}]]", "```" )) }
echo: false results: asis Generate all slides slides <- map2(plot_list_q, seq_along(plot_list_q), create_slide) cat(unlist(slides), sep = "n")
There are indeed two slides, but the plot is not generated:
Would love to get some community insight. I hope to avoid manually creating these slides…