R: Modify the Grid Display List

grid.DLapply {grid} | R Documentation

## Modify the Grid Display List

### Description

Call a function on each element of the current display list and replace the element with the result.

### Usage

    grid.DLapply(FUN, ...)

### Arguments

`FUN` | A function.
`...` | Further arguments to pass to `FUN` .

### Details

This is an insanely dangerous function (for the grid display list).

Two token efforts are made to try to avoid ending up with complete garbage on the display list:

1. The display list is only replaced once all new elements have been generated (so an error during generation does not result in a half-finished display list).

2. All new elements must be either `NULL` or inherit from the class of the element that they are replacing.

### Value

The side effect of this function is to modify the grid display list.

### See Also

Grid.

### Examples

    grid.newpage()
    grid.rect(width=.5, height=.5, gp=gpar(fill="grey"))
    grid.DLapply(function(x) { if (is.grob(x)) x$gp <- gpar(); x })
    grid.refresh()

[Package grid version 2.15.2 Index]