[R] Help with a R script using grid

Michael Muratet mmuratet at hudsonalpha.org
Mon Oct 22 17:05:02 CEST 2012

Dear Dr. Murrell

Sorry to bother you at home, so to speak, but my emails to r-help at r-project.org 
  are falling into the void.

I am trying to make a multiple panel plot with 26 rows and 2 columns  
with plots from a tool (genoPlotR) that is layered on grid. My code  
and session info are below. When I execute the code, I get a single  
plot in the center of the graphics page. I have tried various viewport  
and pop/push/down/seekViewport commands. There must be something I'm  
missing in the documentation, I believe what I have should work. I  
have been able to find a few similar scenarios in the help archives  
but enlightenment eludes me.

Could I get you to critique my latest version of the code below and  
help me figure out how to combine multiple plots in columns and rows?  
The code below produces a graphic with all the plots overlaid on the  
left middle side of the graphics window. And I get the following  
warnings repeated 50 times:

 > warnings()
Warning messages:
1: In while (!rootVP(pvp)) { ... :
   the condition has length > 1 and only the first element will be used

plotpush <- function(x,n,letter,row,column,layout) {


gl <- grid.layout(nrow=26,ncol=2)
pushViewport(viewport(layout = gl)

segs <- c(segs.cys.115,segs.cys.196,segs.asp.388,segs.asp.1060,segs.gly)


 > sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
[1] GenomicFeatures_1.9.41 AnnotationDbi_1.19.38   
Biobase_2.17.8         GenomicRanges_1.9.65   IRanges_1.15.44     
[7] genoPlotR_0.8          ade4_1.4-17

loaded via a namespace (and not attached):
[1] biomaRt_2.13.2      Biostrings_2.25.12  bitops_1.0-4.1       
BSgenome_1.25.8     DBI_0.2-5           RCurl_1.91-1
[7] Rsamtools_1.9.30    RSQLite_0.11.2      rtracklayer_1.17.19  
stats4_2.15.0       tools_2.15.0        XML_3.9-4
[13] zlibbioc_1.3.0



Michael Muratet, Ph.D.
Senior Scientist
HudsonAlpha Institute for Biotechnology
mmuratet at hudsonalpha.org
(256) 327-0473 (p)
(256) 327-0966 (f)

Room 4005
601 Genome Way
Huntsville, Alabama 35806

More information about the R-help mailing list