2013-05-01 95 views
1

我設法用4個不同的圖創建一個單一的情節。但軸標籤不顯示。因爲我是R的初學者,如果有人能告訴我如何爲這種情節添加軸標籤,我會很感激。 X軸:程度 Y軸:日誌(累積分佈)如何將軸標籤添加到R中的多槽?

該圖使用igraph-Functions。

這裏是圖: enter image description here 這裏是我的代碼:

par(mar = rep(2, 4)) 
par(mfrow=c(2,2))    
ddU <- degree.distribution(USAN_g_num, cumulative=TRUE, mode="in") 
plot(ddU, log="xy", col=ifelse(degree.distribution(USAN_g_num, cumulative=FALSE,  mode="in")==0 ,'white',"black"), 
pch=ifelse(degree.distribution(USAN_g_num, cumulative=FALSE, mode="in")==0 ,10,20), 
cex=ifelse(degree.distribution(USAN_g_num, cumulative=FALSE, mode="in")==0 ,0,1),xlab="degree", ylab="log(cumulative frequency)",main="USAN") 

    ddS <- degree.distribution(SAg, cumulative=TRUE, mode="in") 
    plot(ddS, log="xy", col=ifelse(degree.distribution(SAg, cumulative=FALSE, mode="in")==0 ,'white',"black"), 
    pch=ifelse(degree.distribution(SAg, cumulative=FALSE, mode="in")==0 ,10,20), 
    cex=ifelse(degree.distribution(SAg, cumulative=FALSE, mode="in")==0 ,0,1),xlab="degree", ylab="log(cumulative frequency)",main="SA") 

    ddO <- degree.distribution(OWg, cumulative=TRUE, mode="in") 
    plot(ddO, log="xy", col=ifelse(degree.distribution(OWg, cumulative=FALSE, mode="in")==0 ,'white',"black"), 
    pch=ifelse(degree.distribution(OWg, cumulative=FALSE, mode="in")==0 ,10,20), 
    cex=ifelse(degree.distribution(OWg, cumulative=FALSE, mode="in")==0 ,0,1),xlab="degree", ylab="log(cumulative frequency)",main="OW") 

    ddT <- degree.distribution(STg, cumulative=TRUE, mode="in") 
    plot(ddT, log="xy", col=ifelse(degree.distribution(OWg, cumulative=FALSE, mode="in")==0 ,'black',"black"), 
    pch=ifelse(degree.distribution(STg, cumulative=FALSE, mode="in")==0 ,10,20), 
    cex=ifelse(degree.distribution(STg, cumulative=FALSE, mode="in")==0 ,0,1),xlab="degree", ylab="log(cumulative frequency)",main="ST") 

謝謝

+0

degree.distribution函數屬於哪個包/庫? – 2013-05-01 14:28:31

+0

@AndreSilva它屬於igraph – SWR 2013-05-01 14:29:12

回答

2

你不會看到x和y軸的標籤,因爲你的設置太窄保證金底部和左側的地塊與mar=。嘗試將其增加到4或更高。

par(mar = c(4,4,2,2)) 
par(mfrow=c(2,2)) 
plot(1:10,xlab="mm",ylab="kk") 
plot(1:10,xlab="mm",ylab="kk") 
plot(1:10,xlab="mm",ylab="kk") 
plot(1:10,xlab="mm",ylab="kk") 
+0

謝謝。它工作,我學到了新東西。 – SWR 2013-05-01 14:38:49