I save several plots in a list as one file using ggsave
. I recently did an update to ggplot2
and my function has stopped working. Please could someone help me.
My code that is not working is as follows (however this used to work before):
library(tidyverse)
plot_1 <- cars %>%
ggplot(aes(speed, dist)) + geom_line()
plot_2 <- cars %>%
ggplot(aes(dist, speed)) + geom_line()
ggplot2::ggsave(filename = "myplot.pdf",
plot = map(list(plot_1, plot_2), print),
device = "pdf")