change the background color of grid.arrange output

ggplot2, r, r-grid

Solution

Try setting the `bg =` argument to `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()

Problem

I am using `grid.arrange` from `gridExtra` package to put two graphs on one page and save it to a png file. I like to change the background colour of the final png file that is produced by `grid.arrange`. Is it possible? I was not able to come across any info. ``` grid.arrange(p1, p2, main=textGrob("CPU Util", gp=gpar(cex=1.2, fontface="bold", col="#990000")), ncol = 1, clip=TRUE) ```

Original source

Related problems