[R] could I remove or move points in locator() based on plot()?

David Carlson dcarlson at tamu.edu
Fri Aug 2 20:48:05 CEST 2013


You cannot move or edit them interactively, but you can save
the locations of those points by using:

> a <- locator(type="o")

# e.g. click on three locations

> a
$x
[1] 0.8559376 1.1778126 1.2340626

$y
[1] 1.2256976 1.2501162 0.8402324

You could now delete or modify the points and then use lines()
or points() to add them to a new graph.

> plot(1, 1)
> lines(a, type="o")
> points(a, pch=16, col="red")

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Daniel
Guetta
Sent: Friday, August 2, 2013 12:23 PM
To: David Winsemius
Cc: R-help at r-project.org
Subject: Re: [R] could I remove or move points in locator()
based on plot()?

Depending on the complexity of your graphic, you could also
just re-draw
the entire thing every time you want to make a change.

Daniel


On Fri, Aug 2, 2013 at 10:17 AM, David Winsemius
<dwinsemius at comcast.net>wrote:

>
> On Aug 2, 2013, at 2:26 AM, Klot Lee wrote:
>
> > Hi,
> > The function locator() allows me to add points by mouse on
function
> plot()
> > I have draft. But the points can not be edit once I have
made the click.
> > How can I remove or just move the points I made on the
draft?
>
> You cannot. The plotting model for base graphics is
indelible ink. The
> best you could do would be to plot white on top of black.
>
> --
> David.
> >
> > I use the locator function like this:
> >
> >> plot(1,1)
> >> locator(type="o")
> >
> >
> > Thanks.
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

______________________________________________
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