Skip to content

Problem going back to a viewport with gridBase

1 message · Gabor Grothendieck

#
On 5/31/05, Paul Murrell <p.murrell at auckland.ac.nz> wrote:
Thanks.  I will study that further.  One other question:

Using layout or mfcol/mfrow (both from base graphics) one can 
set it up so each new plot goes into a successive cell.  That is one can
do a traversal of the cells in a layout by just issuing successive
calls to plot.  Is there something analogous to that in grid?   What I
am doing right now is to calculate the row and column of the next cell
and then move to it like this:

   # mm.row[j] gives the row in the layout of the jth cell
   # mm.col[j] gives the col in the layout of the jth cell
   mm <- matrix(seq(nr*nc), nr, nc)
   mm.row <- c(row(mm))
   mm.col <- c(col(mm))

  # go to next cell in the array
   j <- j + 1 # increment position
  pushViewport(viewport(layout.pos.row = mm.row[j], layout.pos.col = mm.col[j]))

Is that how to do it or is there some layout/mfcol-like way?



Thanks.