2015-05-27 18 views
0

當我繪製ggo結果時,它的效果非常好,但是當我將這個圖放入一個RGtk2按鈕的事件中時,情況並非如此。它也不顯示任何錯誤信息,所以我不知道爲什麼情節沒有繪製。
下面是繪製ggo的兩個代碼,帶和不帶按鈕。 首先代碼:clisterprofiler的圖不起作用

library(clusterProfiler) 
library("DOSE") 
data(geneList) 
gene <- names(geneList)[abs(geneList) > 2] 
head(gene) 
ggo <- groupGO(gene = gene, 
organism = "human", 
ont = "BP", 
level = 3, 
readable = TRUE) 
print(ggo) 
barplot(ggo, drop=TRUE, showCategory=12) 

使用按鈕第二個代碼:

library(RGtk2) 
win<-gtkWindow() 
b<-gtkButton("ok") 
win$add(b) 
gSignalConnect(b,"clicked",l<-function(b){ 
library(clusterProfiler) 
library("DOSE") 
data(geneList) 
gene <- names(geneList)[abs(geneList) > 2] 
ggo <- groupGO(gene = gene, 
organism = "human", 
ont = "BP", 
level = 3, 
readable = TRUE) 
print(ggo) 
barplot(ggo, drop=TRUE, showCategory=12) 
}) 

回答

0

也許調用打印明確。

print(barplot(ggo, drop=TRUE, showCategory=12))