2012-12-03 60 views
2

我使用包中的grid.arrange將兩個圖形放在一個頁面上並將其保存到png文件中。我喜歡改變由grid.arrange產生的最終png文件的背景顏色。可能嗎?我無法遇到任何信息。更改grid.arrange輸出的背景顏色

grid.arrange(p1, p2, main=textGrob("CPU Util", gp=gpar(cex=1.2, fontface="bold", col="#990000")), ncol = 1, clip=TRUE) 

回答

7

嘗試設置bg =參數png()

library(gridExtra) 
library(lattice) 

png(bg = "wheat1") 
    grid.arrange(xyplot(1:10~1:10, pch=16), xyplot(1:4~1:4, pch=16)) 
dev.off() 

enter image description here