identify.hexbin {hexbin}R Documentation

Identifying Hexagons on a Hexbin Graphic


Identify reads the position of the graphics pointer (typicaly controlled by the mouse) when the (first mouse) button is pressed. It then searches the coordinates of the hexagon centers for the coordinate closest to the pointer. If this coordinate is close to the pointer, its index will be returned as part of the value of the call.


## S3 method for class 'hexbin':
identify(x, labels, offset=0, ...)


x a hexbin object.
labels vector giving labels for each of the hexagons. If supplied, it must have the same length as x$n. The default is to use the cell counts.
offset the distance (in character widths) which separates the label from identified points.
... further arguments to par() and identify.default().


If in addition, plot is TRUE, the point is labelled with the corresponding element of text.

The labels are placed either below, to the left, above or to the right of the identified point, depending on where the cursor was.

The identification process is terminated by pressing any mouse button other than the first.

If the window is resized or hidden and then exposed before the identification process has terminated, any labels drawn by identify will disappear. These will reappear once the identification process has terminated and the window is resized or hidden and exposed again. This is because the labels drawn by identify are not recorded in the device's display list until the identification process has terminated.


If pos is FALSE, an integer vector containing the indexes of the identified points. If pos is TRUE, a list containing a component ind, indicating which points were identified and a component pos, indicating where the labels were placed relative to the identified points.


Nicholas Lewin-Koh

See Also

identify, plot.hexbin, hexagons, hexbin.


if(dev.interactive()) {
  x <- rnorm(1000)
  y <- rnorm(1000)
  hb <- hexbin(x,y)
  ## Now with user supplied labels

[Package hexbin version 1.0.10 Index]