# Create full plot
library(ggplot2)
data("mtcars")
p <- mtcars |>
ggplot(aes(factor(vs),
color = gear,
fill= gear,
group = gear)) +
geom_bar() +
facet_wrap(~am)
p
plot_list <- reveal_x(p)
plot_list[[1]]
plot_list[[2]]
plot_list[[3]]
# Save plots
reveal_save(plot_list, "myplot.png", width = 8, height = 4, path = tempdir())
# Clean temp files
file.remove(list.files(path = tempdir(), pattern = "myplot", full.names = TRUE))
Run the code above in your browser using DataLab