RegionSelection-class {plumbr} | R Documentation |
The ItemSelection
class implements
Selection
for the selection of 1D and 2D regions
in plot/data space.
Description
The ItemSelection
class implements
Selection
for the selection of 1D and 2D regions
in plot/data space.
Constructor
RegionSelection(delegate = NULL)
: Constructs anRegionSelection
object with the underlying selection provided bydelegate
, which may be a function or any other R object. If it is not a function,delegate
must support coercion to amatrix
as described in the next section. However,delegate
is usually a function that is invoked whenever the selection is stored or retrieved. If the function is called with no arguments, it should return the selection. Otherwise, the argument is the new selection status, and the function should store it. This is the same semantic as active bindings. This dynamic functionality allows proxying of otherSelection
objects or external sources, such as a selection model from a GUI toolkit.
Interpreting the Selection
Any R object can represent the underlying selection, so for simplicity
we recommend that the client interpret the selection through
coercion. Currently, there is only one supported coercion of
RegionSelection
:
as.matrix(x)
: returns a matrix with a column for each dimension and a row for each point. In the 2D case, the points describe one or more polygons. As with thepolygon
function, polygons are separated by rows ofNA
, and the last point is connected with the first. In the 1D case, the single column might encode, for example, selections of factor levels in an area plot.
We will probably need to add more coercions as use cases arise. This is still very preliminary.
Supported Selection Calculus
For now, RegionSelection
only supports the add
operation
described in the documentation for Selection
.
Author(s)
Michael Lawrence
See Also
Selection
for the rest of the details.
Examples
## forthcoming