8.5 Multiple Plot Display

One potential helpful parameter setting is the ability to insert multiple plots in one window. The mfrow parameter changes the print setting to allow multiple graphs in one window. Here the mfrow=c(2,2) coding displays a 2x2 table.

The parameter oma stands for outer margin area.

The order of numbers when adjusting the margins is: bottom, left, top, right (clockwise). By setting the third parameter to a “2”, we allow for a wider top-margin so that you can put a grand title over all graphs. You can experiment with changes to this setting on your own.

par(mfrow=c(2,2), oma = c(0,0,2,0)) # puts 4 plots in one window (2x2)

plot(t, A1, type = "l", xlab = "Time (in years)", 
     ylab = "AV  (i = 0.05)", ylim = c(1000, 2500),
     main = "Accumulated Value \nof $1000 Investment")

plot(t, A2, type = "l", xlab = "Time (in years)", 
     ylab = "AV  (i = 0.03)", ylim = c(1000, 2500),
     main = "Accumulated Value \nof $1000 Investment")

plot(t, A3, type = "l", xlab = "Time (in years)", 
     ylab = "AV (i = 0.07)", ylim = c(1000, 2500),
     main = "Accumulated Value \nof $1000 Investment")

mtext("A Grand Title", outer=TRUE, cex = 1.5, col="olivedrab")

Notice that the plot titles have been printed on two lines, as well as the y-axes shown with common values.