Is there a quick and easy function to undo a segment or remove it from your plot?
p1 <- locator(1)
p2 <- locator(1)
segments(p1$x, p1$y, p2$x, p2$y, col = 'pink')
//Undo segments
What I mean to say is, is it possible to store the line segment (color/intensity of each pixel) you are about to erase, and then later on add that line segment where the pink one was to in effect undo the pink segment draw. How would one accomplish this?
You can do it with Grid graphics,