我正在制作带有右键单击弹出菜单的 GUI,在图形上但同时出现一个带有复制或保存图形选项的弹出菜单,我如何删除最后一个弹出菜单?
library(cairoDevice)
library(ggplot2)
library(gWidgets)
library(gWidgetsRGtk2)
require(RGtk2)
plot1<-ggplot(mtcars, aes(wt, mpg))+ geom_point(colour = "black", size = 3)
plot2<-ggplot(mtcars, aes(wt, mpg))+geom_point(colour = "red", size = 3)
plot3<- ggplot(mtcars, aes(wt, mpg))+ geom_point(colour = "yellow", size = 3,shape=20)
options(guiToolkit = "RGtk2")
w <-gwindow("GUI")
g <-ggroup(cont=w)
graphic1 <- ggraphics(cont=g)
print(plot1)
ml<-list()
ml$plot2<- list(handler=function(h,...){
svalue(graphic1)<- print(plot2)
})
ml$plot3<- list(handler=function(h,...){
svalue(graphic1)<-print(plot3)
})
add3rdMousePopupmenu(obj=graphic1,menulist=ml,action=graphic1)`