[R] grid.grill?

Paul Murrell p.murrell at auckland.ac.nz
Sun Feb 23 21:00:03 CET 2003


M.Kondrin wrote:
> Why this command does not return grob? What is special about grill and 
> what makes it different from axis, lines, rectangles...

Most of the predefined grid drawing functions do two things:  draw 
something and create and (invisibly) return a grob (graphical object). 
This means that they can be used in several different ways: 
"procedurally" just for their side effect (drawing something); or 
"functionally" for the object they produce (e.g., to use in the 
placement or sizing of another object); or both (e.g., to have a record 
of what has been drawn that can be uniquely identified and edited).  The 
default behaviour is "both" so that grid functions appear to work like 
their standard graphics counterparts (i.e., they just draw something).

Functions that call the grid drawing functions can choose to just draw 
something, or they can choose to use the graphical objects from the grid 
functions to produce a graphical object of their own.  Ideally, a new 
function will do the latter so that functions that want to call it also 
have a choice.  But it is easier to write a function that just does drawing.

grid.grill is an example of a function that just does drawing.  It's a 
convenience function that was easy to write.  It should be rewritten to 
produce a graphical object at some stage -- perhaps a good exercise for 
someone learning grid? :)

Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz

More information about the R-help mailing list