Q:

how to plot multiple graphs in r with a single x label

reset <- function() {
    par(mfrow=c(1, 1), oma=rep(0, 4), mar=rep(0, 4), new=TRUE)
    plot(0:1, 0:1, type="n", xlab="", ylab="", axes=FALSE)
    }

par(mfrow=c(3,1),oma=c(2,2,0,0))

plot(1,1)
plot(1,1)
plot(1,1)

mtext("The x Label",side=1,line=0,outer=TRUE,cex=1.3)
mtext("The y Label",side=2,line=0,outer=TRUE,cex=1.3,las=0)

reset()
legend("top", legend=c("A", "B"), fill=c("red", "blue"), ncol=2, bty="n")
1

New to Communities?

Join the community