2011-02-24 96 views
2

我想在格子中定製標題...特別是對於splom,我想要刪除圖形底部的標題「散點圖矩陣...」。R:格子圖形標題

splom(
    iris[,1:4], 
    upper.panel = function(x, y, ...) { 
     panel.xyplot(x, y) 
     l <- lm(y~x) 
     panel.xyplot(x,fitted(l), type="l") 
     l <- lowess(x,y) 
     panel.xyplot(l$x, l$y, col="red", type="l") 
     panel.xyplot(x, y) 
    }, 
    lower.panel = function(x, y, ...) { 
     x1 <- range(x,na.rm=T) 
     y1 <- range(y,na.rm=T) 

     panel.text(min(x1)+(max(x1)-min(x1))/2, min(y1)+(max(y1)-min(y1))/2, labels=round(cor(x,y),3), cex=2) 
    }, 
) 

由於提前,

P.

+0

這不是一個將xlab設置爲空字符串的情況嗎? – DorinPopescu 2016-12-02 17:08:25

回答

2

像這樣的事情?

splom(
     iris[,1:4], 
     upper.panel = function(x, y, ...) { 
      panel.xyplot(x, y) 
      l <- lm(y~x) 
      panel.xyplot(x,fitted(l), type="l") 
      l <- lowess(x,y) 
      panel.xyplot(l$x, l$y, col="red", type="l") 
      panel.xyplot(x, y) 
     }, 
     lower.panel = function(x, y, ...) { 
      x1 <- range(x,na.rm=T) 
      y1 <- range(y,na.rm=T) 

      panel.text(min(x1)+(max(x1)-min(x1))/2, min(y1)+(max(y1)-min(y1))/2, labels=round(cor(x,y),3), cex=2) 
     }, xlab = "" 
) 
+0

太簡單了...謝謝! – pbneau 2011-02-24 12:41:00