'layout function'

#1
hello all,
I am trying the layout function as I need to plot ten plots in 5 rows and 2 columns.
I am trying the following command, but something is going wrong that I could not figure out.
Can you please help me with this?

layout(matrix(c(1,2,3,4,5,6,7,8,9,10),nrows=5, byrow=TRUE), heights=c(3,3,3,3,4),widths=c(4,3) )
layout.show()
par(mar=c(1,1,1,1),omi=c(0,0,0,0))

#and then the plots follow

X <- LI[,4]

plot(Y~X,pch=1,cex=2,cex.lab=0.5,
xlim=c(0,14), ylim=c(0,14),xaxt='n',
ylab="Species Density",xlab="")

text(7,2,"0.4160 0.0967 0.1731",cex=0.8)
mtext("PE 0m", side=3, line=0.2, adj=0, cex=0.8)
D<-lm(Y~X)
abline(D)
summary(D)
#2

X <- LI[,5]
plot(Y~X,pch=1,cex=2,cex.lab=0.5,
xlim=c(0,14), ylim=c(0,14),xaxt='n',xaxt='n',
ylab="",xlab="")

text(7,2,"0.6513 0.0046 0.4242",cex=0.8)
mtext("PE 10m", side=3, line=0.2, adj=0, cex=0.8)

D<-lm(Y~X)
abline(D)
summary(D)
#and so on for total 10 plots.

Thank you
 
#2
If you could use code tags, that would help a lot.
HTML:
[CODE]code here[/CODE]
I think this line:
layout(matrix(c(1,2,3,4,5,6,7,8,9,10),nrows=5, byrow=TRUE), heights=c(3,3,3,3,4),widths=c(4,3) )
Should be:
Code:
layout(matrix(c(1,2,3,4,5,6,7,8,9,10),2,5, byrow=TRUE), heights=c(3,3,3,3,4),widths=c(4,3) )
Then adjust the margins:
Code:
par(mar=c(1,1,1,1))
Also the height and width of your plots may have to be adjusted.
 

JesperHP

TS Contributor
#3
the function matrix do not have an argument called "nrows" it has an argument called "nrow". Hence if you correct this typo what you are writing in #1 is the same as suggested in #2

Code:
layout(matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=5, byrow=TRUE), heights=c(3,3,3,3,4),widths=c(4,3) )
layout(matrix(c(1,2,3,4,5,6,7,8,9,10),2,5, byrow=TRUE), heights=c(3,3,3,3,4),widths=c(4,3) )