[R-sig-ME] Identification of points in Scatter Plot

Ben Bolker bbolker at gmail.com
Sun Mar 20 23:20:21 CET 2011


Shankar Lanke <shankarlanke at ...> writes:

> 
> Dear All,
> 
> I am new to R blog.
> 
> I am unable to figure out how to identify specific or some points in XY
> scatter plot.
> 
> How to identify a point coordinates in R scatterplot.
> 
> For example I have couple of points which are away from the line of identity
> and I want to know the ID's or x,y coordinates of these points as shown in
> the below table.
> 
> There is an function  identify(X ,labels=DV) but there is an error executing
> it.
> ID  X    Y
> 1  0.5  0.4
> 1  0.2  0.1
> 1  1      2
> 1  4      5
> 2  2.5   3
> 2  3      4
> 2  0.5  0.4
> 2  0.2  0.1
> 2   1      2
> 2   4      5
> 2  2.5   3
> 2  3      4
> 3  0.5  0.4
> 3  0.2  0.1
> 3  1      2
> 3   4      5
> 3  2.5   3
> 3  3      4

  Unfortunately this question is (1) better for the general r-help
list than for this list (which is specialized for mixed model questions);
(2) not reproducible.  Please read the posting guide for the 
main R-help mailing list (google it or see the bottom of any post for
the link); it is nice that you have given your data, but dput() provides
a more convenient format for helping people reproduce the problem.
Most important, you didn't tell us what error message you got.
Although it's probably irrelevant here, it's generally a good idea
to tell us what platform you're on/provide the results of sessionInfo().

For what it's worth, the following works for me:

d <- data.frame(ID=1:5,x=runif(5),y=runif(5))
plot(d$x,d$y)
identify(d$x,d$y,labels=d$ID)




More information about the R-sig-mixed-models mailing list