The problem is that most base plotting functions first wipe the graphics device clean. To do what you want, you need to use par(new = T) liberally between plots. Does that work for you?
Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Davis Sent: Tuesday, September 07, 2004 10:01 AM To: r-help Subject: [R] gridBase and heatmap I would like to use gridBase to place four separate heatmaps (actually, a stripped-down heatmap.2 from ght gregmisc package that contains only the "image" part) into four different viewports. I can get the placement correct, but I keep 'losing' the previous plot. Any suggestions? Here is some quick example code trying to put a heatmap into the left viewport and then put a second one into the upper right. Thanks in advance for insight.... Sean > pushViewport(viewport(layout = grid.layout(1, 3, widths = unit(rep(1,3), c("null", "cm", "null"))))) viewport[GRID.VP.177] > pushViewport(viewport(layout.pos.col=1)) viewport[GRID.VP.178] > par(omi=gridOMI(),new=T) > my.heatmap(eb$coefficients[(clsum[,1]>1) & (clsum[,2]>1) & (clsum[,3]==0),],breaks=c(seq(-2.5,-0.6,0.1), -0.1,0.10,seq(0.6,2.5,0.1)),dendrogram="none",Colv=c(9:12,5:8,1: 4),labRow=rep('',520),margin=c(10,5),colsep=c(4,8),trace="none",density. info="none",col=greenred.colors(40),key=F) > popViewport() viewport[GRID.VP.177] > pushViewport(viewport(layout.pos.col=3)) viewport[GRID.VP.179] > pushViewport(viewport(layout = grid.layout(3, 1, heights = unit(rep(1,3), c("null", "null", "null"))))) viewport[GRID.VP.180] > pushViewport(viewport(layout.pos.row=1)) viewport[GRID.VP.181] > par(omi=gridOMI(),new=T) > my.heatmap(eb$coefficients[(clsum[,1]>1) & (clsum[,2]>1) & (clsum[,3]==0),][tmp[505:520],],breaks=c(seq(-2.5,-0.6,0.1), -0.1,0.10,seq(0.6,2.5,0.1)),dendrogram="none",labRow=sapply(getSYMBOL(as .character(rownames(eb$coefficients[(clsum[,1]>1) & (clsum[,2]>1) & (clsum[,3]==0),])),'BrafPkg')[tmp[505:520]],function(x) {ifelse(is.na(x),"EST",x)}),Colv=c(9:12,5:8,1: 4),margin=c(10,5),colsep=c(4,8),trace="none",density.info="none",col=gre enred.colors(40),key=F) ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html