I am using the pdf() function generate a pdf of figures. Based on my specific data, some figures fit best in a landscape orientation, others in portrait.
I adapted the following code from here: https://bookdown.org/ndphillips/YaRrr/saving-plots-to-a-file-with-pdf-jpeg-and-png.html
I would like the second page to have a different orientation than the first page, but still be contained within the same file.
pdf(file = "/Downloads/My Plot.pdf", # The directory you want to save the file in width = 8, # The width of the plot in inches height = 4) # The height of the plot in inches# Step 2: Create the plot with R codeplot(x = 1:10, y = 1:10)abline(v = 0) # Additional low-level plotting commandstext(x = 0, y = 1, labels = "Random text")plot(x = 20:40, y = 10:30)# Step 3: Run dev.off() to create the file!dev.off()
Thanks!