I'm trying to find the best way to take an R script that generates multiple plots and render it as a Quarto RevealJS presentation where each set of plots gets its own slide.
My current script loops through a list of response variables and, for each one, creates a histogram and a Q-Q plot. In a standard HTML document, I can use patchwork to combine them and print them one after another, which works great.
Here is a reproducible example of my plotting code:
My goal is to have the combined plot for response_1 on one slide, the plot for response_2 on the next slide, and so on. Basically, the look is like in here Revealjs β Quarto. But the content of each slide is in the .qmd in ggplot2 script format.
So when rendered, the .qmd processed the ggplot first, then the generated images were shown in that gallery RevealJS look.
@mthieu is spot-on on combining output: asis with cat(). Here's what slides.qmd could look like, combined with @DaniMori's idea to keep the plot creation and plot printing separate: