Skip to Content

Adding multi-plot axes

In order to generate a layout with multiple plots, I have the following code with some dummy plots:

par(mar=c(2,2,1,1), oma=c(2,4,0,0), xpd=NA)
for (i in 1:10) {
    par(mar=c(2,2,1,1),fig=c(0, 0.5, (10-i)/10, (11-i)/10), new=T)    
        col="blue",axes=F,type="l",lwd=10, xlab="",ylab="")
    par(mar=c(2,2,1,1),fig=c(0.5, 1, (10-i)/10, (11-i)/10), new=T)    
        col="red",axes=F,type="l",lwd=10, xlab="",ylab="")    

I want to add a vertical line/axis on the far LHS and the far RHS that span all 10 plots in a column. Since I will use this line as an axis, I need to be able to add ticks and labels.