Stretched plots in R when plotting multiple figures to PDF -
i'm trying create pdf multiple plots in pdf, when create pdf 2 x 2 plots plots square , looks nice:
pdf(file=paste0("test.pdf"), paper = "a4") par(mfrow=(c(2,2)), omi=c(0,0,0,0), mar=c(2, 2, 0, 0)) (i in 1:4) { plot(1:10) } dev.off()
however if try generate pdf 3 rows , 2 columns plots not square. plots seems stretched entire 3 x 2 matrix of plots squared:
pdf(file=paste0("test 2.pdf"), paper = "a4") par(mfrow=(c(3,2)), omi=c(0,0,0,0), mar=c(2, 2, 0, 0)) (i in 1:6) { plot(1:10) } dev.off()
how individual plots square in configuration number of rows , columns not equal?
thanks in advance.
apparantly can use layout instead
pdf(file=paste0("test 2.pdf"), paper = "a4") layout(matrix(1:6, 3, 2, byrow = true), respect = true) par(omi=c(0,0,0,0), mar=c(2, 2, 0, 0)) (i in 1:6) { plot(1:10) } dev.off()
Comments
Post a Comment