I'd like to put several plots into one PDF, with a new page for each plot. Each plot is generated with ggplot, and each needs a different scale.
I know how to output individual plots into individual PDFs at the appropriate scale, like so:
plot1 <-
ggplot(mtcars, aes(x=hp, y=mpg)) +
geom_point()
ggsave(file="plot1.pdf", plot=plot1, scale=3)
plot2 <-
ggplot(mtcars, aes(x=wt, y=hp)) +
geom_point()
ggsave(file="plot2.pdf", plot=plot2, scale=1)
I also know how to put multiple plots into one PDF, with each plot on a separate page, like so:
# Open PDF to save all plots to
pdf(file="plots.pdf")
# Print plots to the pdf
print(plot1)
print(plot2)
# Turn off PDF plotting
dev.off()
However, what I can't work out is how to give each individual plot within the PDF a different scale?