Skip to content
Prev 78359 / 398502 Next

grob questions

Hi
Gabor Grothendieck wrote:
First, if the xaxisGrob has at=NULL then it calculates its tick-marks at 
drawing time (based on the viewport it gets drawn in).  So it does not 
store any labels (it doesn't know what they are until it gets drawn). If 
you specify a non-NULL 'at' then the axis creates labels.

Second, grid grobs are standard R objects (copy-on-modify) so the object 
'myplot' is not the same object that is being modified by the calls to 
grid.edit().  grid.edit() destructively modifies a copy of the grob that 
grid has stored on its display list;  you refer to the appropriate grob 
via its name (not via an R object).  By comparison, editGrob() takes a 
grob and returns a modified copy of the grob, for example ...

myplot <- editGrob(myplot, at = 1:10/11)

The naming scheme for grid functions is:  grid.<*>() functions for 
producing or working with graphical *output* (drawing grobs or working 
with grobs that have been drawn) and <*>Grob() functions for working 
(off-screen) with grobs.
The getGrob(), editGrob(), etc functions for working with grobs (and 
sub-grobs) off-screen and grid.get(), grid.edit(), etc for working with 
graphical output.

"Recent changes in grid graphics". R News, 5(1):12-20, May 2005 
describes this some more.

Paul