Answers for "plot multiple graphs in r"

1

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")
Posted by: Guest on September-15-2020
0

plot multiple plots in r

# One figure in row 1 and two figures in row 2
# row 1 is 1/3 the height of row 2
# column 2 is 1/4 the width of the column 1
attach(mtcars)
layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE),
   widths=c(3,1), heights=c(1,2))
hist(wt)
hist(mpg)
hist(disp)
Posted by: Guest on December-17-2020

Code answers related to "plot multiple graphs in r"

Browse Popular Code Answers by Language