[R] plot 7 * 3 matrix on DIN A4 pdf from stefan.duke_at_gmail.com on 2008-05-23 (R help archive)

[R] plot 7 * 3 matrix on DIN A4 pdf

From: <stefan.duke_at_gmail.com>
Date: Thu, 22 May 2008 23:30:09 +0200


Hello,

I want to plot 21 scatter plots in a 7*3 matrix on a single A4 page (using mfcol). Below is an example, which -by and large- looks very close to the desired result. But I do not get it to fill out the whole page. If I specify the a different page size, the plots still do not fill out the whole page.
Anybody an idea what to do? Maybe adjusting indvidiual plot size (if so, how?). Or is there a neater command to create a matrix of individual plots
Best,
Stefan

pdf(file='c:/matrix1.pdf',paper='a4',pagecentre=F)

x<-c(rnorm(mean(100,mean=50,sd=10)),rnorm(mean(100,mean=50,sd=10))) par(mfcol=c(7,3))
par(pch=19)
 par(pty="m") #"s" makes a square plot
 par(cex=.1)

 par(cex.axis=7)

 par(omi=c(1,1,1,1))
 axistick<-c(0,10,20,30,40,50,60,70,80,90,100)
par(mar=c(3, 5, 0, 0) + 0.1)

plot(x,xlim=c(0,50),ylim=c(0,100),axes = FALSE) axis(2,ylab='',at=axistick)
box(lty=1)
plot(x,xlim=c(0,50), ylim=c(0,100),axes = FALSE) axis(2)
box(lty=1)
plot(x, xlim=c(0,50),ylim=c(0,100),axes = FALSE) axis(2)
box(lty=1)
plot(x,xlim=c(0,50), ylim=c(0,100),axes = FALSE) axis(2)
box(lty=1)
plot(x,xlim=c(0,50), ylim=c(0,100),axes = FALSE) axis(2)
box(lty=1)
plot(x,xlim=c(0,50), ylim=c(0,100),axes = FALSE) axis(2)
box(lty=1)
par(mar=c(3, 5 ,0, 0) + 0.1)
plot(x,xlim=c(0,50), ylim=c(0,100),axes = FALSE) axis(2)
 axis(1,ylab='UAS_7')
 box(lty=1)

par(mar=c(3, 0, 0, 0) + 0.1)
plot(as.integer(Sex),GER_TOTAL,ylim=c(0,100),xlim=c(0,3),axes = FALSE,pch=12) box(lty=1)
plot(x,ylim=c(0,100),xlim=c(0,3),axes = FALSE,pch=12) box(lty=1)
plot(x,ylim=c(0,100),xlim=c(0,3),axes = FALSE,pch=12) box(lty=1)
plot(x,ylim=c(0,100),xlim=c(0,3),axes = FALSE) box(lty=1)
plot(x,ylim=c(0,100),xlim=c(0,3),axes = FALSE,pch=12) box(lty=1)
plot(x,ylim=c(0,100),xlim=c(0,3),axes = FALSE,pch=12) box(lty=1)
par(mar=c(3, 0, 0, 0) + 0.1)
plot(as.integer(Sex),GER_F6,ylim=c(0,100),xlim=c(0,3),axes = FALSE) axis(1,at=c(1,2),ylab='Sex')
box(lty=1)

par(mar=c(3, 0, 0, 0) + 0.1)
plot(x,xlim=c(0,100),ylim=c(0,100),axes = FALSE,pch=12) box(lty=1)
plot(x,xlim=c(0,100), ylim=c(0,100),axes = FALSE) box(lty=1)
plot(x, xlim=c(0,100),ylim=c(0,100),axes = FALSE) box(lty=1)
plot(x, xlim=c(0,100),ylim=c(0,100),axes = FALSE) box(lty=1)
plot(x, xlim=c(0,100),ylim=c(0,100),axes = FALSE,pch=12) box(lty=1)
plot(x, xlim=c(0,100),ylim=c(0,100),axes = FALSE) box(lty=1)
par(mar=c(3, 0, 0, 0) + 0.1)
plot(x,xlim=c(0,100),ylim=c(0,100),axes = FALSE,pch=12) box(lty=1)
axis(1,ylab='Sex')
dev.off()



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 22 May 2008 - 21:33:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 23 May 2008 - 09:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive