On 10.05.2011 03:36, John S wrote:
Dear Friends, I have been trying to save multiple 3x3 (mfrow=c(3,3) graphics inside a loop using tiff figure format (not using PDF or savePlot functions) with no success. Could you please help? Here is a simplified example code: dat=data.frame (ID=rep(1:10,each=10),IDV=rep(seq(1:10),times=10)) dat$DV<- with(dat, 50+15*IDV) dat=dat[order(dat$ID,dat$IDV),] for(i in 1:10){ dt1 = dat[dat$ID==i,] pagei=as.integer(ceiling(i/9)) #This does not work if(i==1) {tiff(file=paste("Outfile",pagei,".tiff",sep="") ,width=17.15,height=17.15,units="cm", res=1200, pointsize=10, compression = "lzw")}
You may not be able to allocate space for this huge tiffs (at least I am not able to do so under Windows).
if(i==10) {tiff(file=paste("Outfile",pagei,".tiff",sep="") ,width=17.15,height=17.15,units="cm", res=1200, pointsize=10, compression = "lzw")} par(mar=c(5,5,4,1),mfrow=c(3,3)) plot(dt1[, "IDV"],dt1[, "DV"], type="n") lines(dt1[, "IDV"], dt1[, "DV"], type="b", col=1,lwd=3,pch=1) title(paste(i),col=8,cex=.8) if(i==9) dev.off ## close file
Your forgot parentheses after dev.off. Uwe Ligges
} dev.off() The idea is to save 2 files with 3x3 layouts but I only get one subject in Outfile1. OS: Windows 7 64 bits R version 2.13.0 Many Thanks, John [[alternative HTML version deleted]] ______________________________________________ R-help@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.
______________________________________________ R-help@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.