Here is an overview of some alternatives:
http://www.statmethods.net/advgraphs/interactive.html
See also the Imagemap package .
The easiest way to get started is possibly using the identify
function in R directly, it is not as interactive as one might wish, but it serves its purpose if there are not too many points:
mydata = matrix(rnorm(100), ncol=2, dimnames=list(rows=paste('gene', 1:50), cols=c("x","y")))
plot(mydata)
identify(x=mydata[,1], y=mydata[,2], label=rownames(mydata))
Now, click on points and the label will be added as text to the plot. Right-clicking ends it. Tip: If you click to the right of a point, the label will appear on the right, if clicking below, below, etc. However, for a large number of points this might become very clumsy, then using locator as described below might be a better option.
If you want to work with ranged selection, you can use the locator()
function, which returns raw coordinates of your clicks and use function matchpt {Biobase}
to find the points closest to your clicks.
plot(mydata)
clicks = locator()
matchpt(cbind(clicks$x, clicks$y), mydata)
index distance
1 38 0.10874959
2 44 0.13085363
3 4 0.16094422
4 48 0.06573644
5 10 0.07867303
This might look low-tech, but in contrast to more interactive methods works out of the box, while anything else has additional dependencies.
does that do the job Interactive and Animated Scalable Vector Graphics
Hi, thanks for the link, it seems very interesting !
if using ggplot, check
geom_text
!!I use plot at this moment, but definiately will take a look at geom_text when use ggplot.