identifyGrob: return names of clicked grid-objects.

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/gridwork.R

Description

This identifies which grobs (grid objects) bounding boxes were clicked on (or otherwise identified by pixel coordinates), and returns their names. The names can be used by other grid functions, like grid.edit or grid.remove.

Usage

1
identifyGrob(xy.pixels = grid.locator(), classes = NULL)

Arguments

xy.pixels

if given, a list with components x and y, being pixel coordinates in the current plot device.

classes

if given, one or more class names of grobs. This can be used to filter the results to only specified types of objects. Examples: "text", "lines", "segments", "rect".

Details

None yet.

Value

a character vector of grob names, or NULL.

Note

This will give an error if the current plot has no grobs, as returned by grid.ls.

Author(s)

Felix Andrews [email protected]

See Also

grobBoundingBoxes

Examples

1
2
3
4
5
6
7
8
if (interactive()) {

xyplot(1:10 ~ 1:10)
identifyGrob()
str(grid.get(identifyGrob()[1]))
grid.remove(identifyGrob(class = "points")[1])

}

playwith documentation built on May 29, 2017, 12:28 p.m.