Re: [R] deleting an arow added to a graphic

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Wed 06 Sep 2006 - 19:33:52 GMT

On 9/6/2006 3:04 PM, Graham Smith wrote:
> I know this has got to be simple, but I have a added an arrow to a graph
> with:
>
> arrows(5,8,8, predict(lmfit,data.frame(x=8)), length=0.1)
>
> but its in the wrong position, correcting it and running again adds an new
> arrow (which is what you would expect) so how do I
>
> a) edit the existing arrow, and
> b) delete it all together
>
> As so often seems to be the case, some of the simplist things seem also to
> be the most difficult to find the answer to.
>

Generally "classic" graphics in R are like drawing in ink on paper: you can't remove items that you've drawn there.

So the way to do what you want is to save the commands that produced the   entire graph, and edit them until you get them right. Then you can run them and produce a new graph that's just right.

grid allows items to be removed from an existing graph, so lattice and ggplot inherit this nice property. rgl (for 3d graphics) also allows items to be removed in a fairly inflexible way (only in the reverse order of the order drawn); the next release will make this more flexible.

Duncan Murdoch



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 07 09:01:30 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 07:51:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.