如何删除使用定位器插入的最后一项(如文本框)?即
plot(1:3)
text(locator(1),labels="oops wrong spot...remove me",cex=1,font=1)
Run Code Online (Sandbox Code Playgroud)
您可以非常轻松地实现可以执行此操作的内容:
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()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2905 次 |
最近记录: |