如何删除使用定位器插入的最后一项(如文本框)?IE
plot(1:3)
text(locator(1),labels="oops wrong spot...remove me",cex=1,font=1)
你可以很容易地实现一些可以让你这样做的东西:
locator <- function(...) {
assign('.last.plot', recordPlot(), envir=.GlobalEnv)
graphics::locator(...)
}
undo <- function()
if (exists('.last.plot')) replayPlot(.last.plot)
plot(1:3)
text(locator(1),labels="oops wrong spot...remove me",cex=1,font=1)
undo()