Plot Multiple Diagrams on One Page in R

You can plot multiple diagrams on one page by using par() to set up the page layout. The following R code plot multiple diagrams on one page.

# create a simple data frame
a <- c(1,2,3,4,5)
b <- c(1,2,3,4,4)
df <-data.frame(a,b)

# plot 3 lines
pdf("plot.pdf", width=8,height=11)
par(mfrow=c(2,2),mar=c(4,4,0.5,0.5), oma=c(1.5,2,1,1))
plot(df$a,df$b, type="l")
plot(df$a,df$b, type="l")
plot(df$a,df$b, type="l")

dev.off()

mar - A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1.
oma - A vector of the form c(bottom, left, top, right) giving the size of the outer margins in lines of text.

Here I only added three simple line diagrams. The result looks like the following:

plot-multiple-diagrams-in-one-page-in-R

Category >> R  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>