TeachingDemos (version 2.10)

HWidentify: Show label for point being Hovered over.

Description

These functions create a scatterplot then you Hover the mouse pointer over a point in the plot and it will show an id label for that point.

Usage

HWidentify(x, y, label = seq_along(x), lab.col="darkgreen",
pt.col="red", adj=c(0,0), clean=TRUE, xlab = deparse(substitute(x)),
ylab = deparse(substitute(y)), ...)
HTKidentify(x, y, label = seq_along(x), lab.col="darkgreen",
pt.col="red", adj=c(0,0), xlab = deparse(substitute(x)),
ylab = deparse(substitute(y)), ...)

Arguments

x

x-coordinates to plot

y

y-coordinates to plot

label

Labels to show for each point

lab.col

The color to plot the labels

pt.col

The color of the highlighting point

adj

The adjustment of the labels relative to the cursor point. The default places the label so that its bottom left corner is at the curser, values below 0 or greater than 1 will move the label to not touch the cursor.

clean

Logical value, should any labels on the plot be removed at the end of the plotting.

xlab

Label for x-axis

ylab

Label for y-axis

additional arguments passed through to plot

Value

These functions are run for their side effects, nothing meaningful is returned.

Details

This is an alternative to the identify function. The label only shows up for the point currently closest to the mouse pointer. When the mouse pointer moves closer to a different point, the label changes to the one for the new point. The currently labeled point is also highlighted. HWidentify only works on windows, HTKidentify requires the tkrplot package.

See Also

identify

Examples

Run this code
# NOT RUN {
if( interactive() ){
  tmpx <- runif(25)
  tmpy <- rnorm(25)
  HTKidentify(tmpx,tmpy, LETTERS[1:25], pch=letters)
}
# }

Run the code above in your browser using DataCamp Workspace