Dear all, I have the following code that try to plot simple sinus curve into 2x2 grid in 1 page.
But this code of mine create 4 plots in 1 page each. What's wrong with my approach? __BEGIN__ library(lattice) library(grid) test.plot <- function(x,y) { pushViewport(viewport(layout.pos.col=x, layout.pos.row=y)) pushViewport(viewport(width=0.6, height=0.6)); plot(sin,-pi,2*pi, main= paste(c(i,j),collapse="-") ) } plotfn <- ("~/Desktop/mygrid.pdf") pdf(plotfn) id = 0; for (i in 1:2) { for (j in 1:2) { id = id+1; cat(i, "-", j, "\n", sep="") test.plot(i,j); } } dev.off() __END__ - 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.