Look at ?print.trellis in the lattice package (specifically the split and more argumnets).
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gundala Viswanath > Sent: Tuesday, June 10, 2008 9:27 AM > To: [EMAIL PROTECTED] > Subject: [R] Concat Multiple Plots into one PNG figure > > Dear experts, > > I tried to put the two plots into one final PNG figure with > the following script. > > However instead of giving 2 plots in one figure, it only > gives the the last plot in one figure. > > What's wrong with my script below? > > __BEGIN__ > in_fname <- paste("mydata.txt.",sep="") > out_fname <- paste("finalplot.png",sep="") > > dat <- read.table(in_fname, comment.char = "!" , na.strings = > "null"); dat.pca <- prcomp(dat[,1:ncol(dat)], retx=TRUE, scores=TRUE) > > trellis.device("png", color=TRUE) > png(out_fname) > > # End figure expected to be 1 row 2 columns par(mfrow = c(1,2)) > > # Two plots which I want to put into one PNG figure > xyplot(dat.pca$x[,1] ~ dat.pca$x[,2], xlab="First Component", > ylab="Second Component") xyplot(dat.pca$x[,2] ~ > dat.pca$x[,3], xlab="Second Component", ylab="Third Component") > > dev.off() > > __END__ > > -- > Gundala Viswanath > > > > -- > Gundala Viswanath > > ______________________________________________ > 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.