# Create full plot
library(ggplot2)
p <- mtcars |>
ggplot(aes(mpg, wt,
color = factor(vs),
group = factor(vs))) +
geom_point(aes(shape=factor(am)), size=2) +
geom_smooth(method="lm",
formula = 'y ~ x',
linewidth=1)
p
plot_list <- reveal_aes(p, "shape")
plot_list[[1]]
plot_list[[2]]
plot_list[[3]]
plot_list[[4]]
# 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