Re: [R] clicking on plot and recording XY coords

From: milton ruser <>
Date: Sat, 21 Jun 2008 00:56:43 -0300

Thanks Jim.

I included your suggestion on the script and run fine. But how can I skip (record X and Y as NULL) on some steps? On this example it donīt occour, but when working with real data I will need bypass some acquisitions. Is there a way of do it on a for() looping? I noticed that if I click on right button of mouse the locator() ask for continue or stop. But some times I just want to record NULL for the position.

Thanks a lot,


for (i in 1:number.clicks)
 plot(0,0, type="n")

 seg1<-arrows(-0.5,-1,0.5,0, col=1)
 seg2<-arrows(0,-1,-0.3,0.3, col=2)
 seg3<-arrows(0.2,-0.7,-0.5,0, col=4)

 coord<-locator(1, type="p")
 my.coords<-rbind(my.coords, cbind(x=coord$x, y=coord$y))  }


        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat 21 Jun 2008 - 05:00:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 21 Jun 2008 - 05:30:45 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive