2016-10-03 6 views
0

私は回帰直線を含む15個の散布図をプロットしています。しかし、私はより良い視覚化のために1ページに表示したいと思います。 grid.arrange関数は私たちの興味に応じて複数のプロットを追加するのに役立ちますが、私は常にエラーに直面します。 GLISTで1ページgrid.arrange関数で複数のプロットを追加

エラー(リスト(wrapvp =リスト(x = 0.5、yは0.5、幅= 1、高さ= 1、= "GLIST"

plots <- list() 
for (i in 1:(ncol(xx2)-1)) { 

    cn <- colnames(xx2) 

    reg<-lm(xx2[,i]~xx2[,16], data=data.frame(xx2)) 
    aa<-summary(reg) 
    p1<-plot(xx2[,16], xx2[,i], xlab=cn[16], ylab=cn[i], 
     pch=1, cex.main=1.5, frame.plot=FALSE, col="grey")+ abline(reg, col="blue", lwd=2) + text(max(xx2[,16]/1.3), max(xx2[,i])/2, paste("R-Squared:",round(aa$r.squared,3)),cex = .8) 
    #plot(density(resid(reg))) 
    plots[[i]] <- p1 

} 
grid.arrange(grobs = plots[1:15], ncol=5) 

に許容 のみ 'grobs' をOR

do.call(grid.arrange, c(plots, ncol=3)) 
+0

間違ったタグを削除するように編集中です。 –

答えて

0

grid.arrangeグリッドベースのグラフィックスを必要とします。基本プロット()は何も返しません。あなたはおそらくsplit.screenlayoutpar(mfrow=...)になっているはずです。また(最後の再としてソート)では、2つのシステムを組み合わせる方法については、gridBaseまたはgridGraphicsパッケージを参照してください。

関連する問題