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.
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
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.
Returns a list containing the coordinates that user clicked (or NULL if a mouse click didn't occur):
||Device X coordinate (expressed in pixels)|
||Device Y coordinate (expressed in pixels)|
||User X coordinate (expressed in plot x units). Note that this value is only valid for base graphics.|
||User Y coordinate (expressed in plot y units). Note that this value is only valid for base graphics.|
||NDC X coordinate (0 to 1 from left to right)|
||NDC Y coordinate (0 to 1 from bottom to top)|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.