[R] retrieve x y coordinates of points in current plot

Greg Snow Greg.Snow at imail.org
Sat Mar 5 19:25:44 CET 2011


It is not completely clear what you are trying to accomplish.  Do you want to draw a shape in the plot then identify all the points in that shape?  You could use locator (with type='l') to draw a polygon, then there are functions in add on packages (mostly the spatial ones) that will detect which points are within a polygon that you could use with the raw data and the polygon created.

If that is not what you want, then maybe describe your goals in more detail (examples are good if you can give one).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jannis
> Sent: Saturday, March 05, 2011 7:29 AM
> To: Dieter Menne
> Cc: r-help at r-project.org
> Subject: Re: [R] retrieve x y coordinates of points in current plot
> 
> Thanks for your replies, Dieter and Richard. I am aware of these two
> functions. I wanted, however, to write a similar function to identify
> by
> selecting large clouds of points. For this I would need to rertrieve
> their coordinates after the plot was called and created. As identify()
> is able to do this, I was wondering whether my function could do this
> as
> well in a similar manner. Until now, I have to supply the x and y
> coordinates to my function as well. I would like to avoid this.
> 
> 
> Jannis
> 
> On 03/04/2011 06:55 PM, Dieter Menne wrote:
> > jannis-2 wrote:
> >>
> >> is it somehow possible to retrieve the x and y coordinates of points
> in
> >> a scatterplot after it has been plotted? identify() somehow seems to
> >> manage this, so I was wondering whether it is possible?
> >>
> > locator might be the more basic function you are looking for.
> >
> > Dieter
> >
> >
> > --
> > View this message in context: http://r.789695.n4.nabble.com/retrieve-
> x-y-coordinates-of-points-in-current-plot-tp3335642p3335692.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list