0
我正在使用R包gWidgets。 我想在圖片上添加一個點(.jpg)。在用gimage函數繪製的圖像上添加點(R包gWidgets)
我的代碼是:
require(jpeg)
require(gWidgets)
options(guiToolkit="RGtk2")
w <- gwindow("test")
gimage("yourpath.jpg",dirname="", container = w,toolkit=guiToolkit("RGtk2"))
da <- [email protected]@widget
callbackID <- gSignalConnect(da,"button-release-event", function
(w,e,...) {
# allocation <- w$GetAllocation()
addHandlerClicked(da, handler = function(h,...) {
})
xclick <- e$GetX()
yclick <- e$GetY()
print(xclick)
print(yclick)
points(xclick, yclick)
pressed <<- FALSE
return(TRUE)
})
警告:
plot.new has not been called yet
有人能幫助我嗎? 感謝