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. Many thanks, Graham [[alternative HTML version deleted]]
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
This does not actually remove it but you could overwrite it with an arrow the same color as the background and then plot a new arrow: x <- 1:10 plot(x ~ x) arrows(1, 1, 2, 2) # revise it arrows(1, 1, 2, 2, col = "white") arrows(2, 2, 3, 3) On 9/6/06, Graham Smith <myotisone at gmail.com> 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. > > Many thanks, > > Graham > > [[alternative HTML version deleted]] > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. >