grobCoords {grid}R Documentation

Calculate Points on the Perimeter of a Grob


These functions calculate points along the perimeter (or length) of a grob.


grobCoords(x, closed, ...)
grobPoints(x, closed, ...)
isClosed(x, ...)



A grob object.


Whether we are asking for points along the perimeter of a closed object or points along the length of an open object. Some grobs (e.g., X-splines) can do both.

This defaults to TRUE except for known cases that are not closed (e.g., lines and segments).


Arguments to be used by methods.


The difference between grobCoords and grobPoints is that grobCoords performs all pre- and post-drawing operations on the grob that would normally occur if the grob was being drawn, then calls grobPoints. So the former takes into account any vp and gp settings on the grob. This means that users should usually only want to call grobCoords; only (expert) developers may have a need to call grobPoints.

Custom grobs can write their own methods for grobPoints (see gridCoords).

The isClosed function returns TRUE or FALSE to indicate whether a grob is a closed shape. The default response is TRUE, unless a method has been defined otherwise (e.g., for lines and line segments).


Either a "GridGrobCoords" object (a list of lists with components x and y) or a "GridGTreeCoords" object (a list of "GridGrobCoords" and/or "GridGTreeCoords" objects).

All locations are in inches relative to the current grid viewport.


Paul Murrell

[Package grid version 4.4.0 Index]