Save Multiple plots on different pages on PDF file

To save multiple plots in pdf we use the pdf() function to create and open a pdf file in the R Language.

 After this, whatever we do in the R console gets saved in the pdf file opened. The pdf() function takes the file parameter which contains the name of the pdf along with the relative path to the working directory.

Syntax:

pdf( file )

where,

  • file: determines the name of pdf along with the relative address to the working directory.

Example:

Here, we have saved multiple plots to the different pages in the pdf.

R




# Open pdf file
pdf(file= "sample.pdf" )
  
# draw plots
plot(1:10)
plot(1:20)


Output:

How to Export Multiple Plots to PDF in R?

In this article, we will learn how to export multiple plots to a PDF in the R Programming Language.

Similar Reads

Save Multiple plots on different pages on PDF file:

To save multiple plots in pdf we use the pdf() function to create and open a pdf file in the R Language....

Save Multiple Plots to Same Page in PDF:

...