mouseclick: Receive notification of mouse clicks on a manipulator plot

Description Usage Details Value See Also

Description

This function can be called to determine if a mouse click on the plot was what caused the current invocation of the manipulate expression, and to determine the coordinates which were clicked.

Usage

1

Details

If a mouse click did occur, then the function returns a list with the coordinates which the user clicked on.

If a mouse click did not cause the current invocation of the manipulate expression (e.g. if it was caused by the user changing the value of a control) then the function returns NULL.

The mouse click coordinates are provided in device, user, and ndc coordinates. To convert these coordinates into other coordinate systems (e.g. cm or npc) you can use the grconvertX and grconvertY functions.

Note that the userX and userY coordinates are only applicable for base graphics plots (they are not applicable for grid, lattice, ggplot, etc). Therefore, for non-base graphics the userX and userY values will not contain valid coordinates.

Value

Returns a list containing the coordinates that user clicked (or NULL if a mouse click didn't occur):

deviceX Device X coordinate (expressed in pixels)
deviceY Device Y coordinate (expressed in pixels)
userX User X coordinate (expressed in plot x units). Note that this value is only valid for base graphics.
userY User Y coordinate (expressed in plot y units). Note that this value is only valid for base graphics.
ndcX NDC X coordinate (0 to 1 from left to right)
ndcY NDC Y coordinate (0 to 1 from bottom to top)

See Also

manipulate, grconvertX, grconvertY


manipulate documentation built on May 2, 2019, 3:27 a.m.