If you want to do this with base graphics, I strongly recommend using the layout()
function. It takes a matrix which defines how to split up the window. It will make a row for every row in your matrix and a column for every column. It draws the plots in order of the number of the cells. So if you pass the matrix
#layout(matrix(c(1:7,7), ncol=2, byrow=T))
# [,1] [,2]
#[1,] 1 2
#[2,] 3 4
#[3,] 5 6
#[4,] 7 7
the first plot will go in the upper left, the second in the upper right, etc, until the 7th plot goes all the way at the bottom. You could just have it take up only the bottom left if you like by specifying a different number in the bottom right.
To reset the layout back to "normal" just call
layout(1)
you could then create a for loop to make each plot.
If you want one plot to do all pairwise comparisons, the pairs()
plotting function might be what you want
dd<-matrix(runif(5*5), ncol=5)
pairs(dd)
or the lattice equivalent is splom()