[R] Polygon-like interactive selection of plotted points

roger koenker rkoenker at uiuc.edu
Wed Apr 26 20:39:26 CEST 2006


?in.convex.hull  in the package tripack.


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820


On Apr 26, 2006, at 1:25 PM, Marc Schwartz (via MN) wrote:

> On Wed, 2006-04-26 at 18:13 +0100, Florian Nigsch wrote:
>> [Please CC me for all replies, since I am not currently subscribed to
>> the list.]
>>
>> Hi all,
>>
>> I have the following problem/question: Imagine you have a two-
>> dimensional plot, and you want to select a number of points, around
>> which you could draw a polygon. The points of the polygon are defined
>> by clicking in the graphics window (locator()/identify()), all points
>> inside the polygon are returned as an object.
>>
>> Is something like this already implemented?
>>
>> Thanks a lot in advance,
>>
>> Florian
>
> I don't know if anyone has created a single function do to this  
> (though
> it is always possible).
>
> However, using:
>
>   RSiteSearch("points inside polygon")
>
> brings up several function hits that, if put together with the above
> interactive functions, could be used to do what you wish. That is,  
> input
> the matrix of x,y coords of the interactively selected polygon and the
> x,y coords of the underlying points set to return the points inside or
> outside the polygon boundaries.
>
> Just as an FYI, you might also want to look at ?chull, which is in the
> base R distribution and returns the set of points on the convex  
> hull of
> the underlying point set. This is to some extent, the inverse of what
> you wish to do.
>
> HTH,
>
> Marc Schwartz
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting- 
> guide.html




More information about the R-help mailing list