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)
When working with
ggplot2
, I also found useful theggdraw()
function from thecowplot
package as showed here.Here is an example:
While
p1
andp2
have already theplot.background
fill set, there remains a thin line between them that disappears when wrapping thegrid.arrange
withcowplot::ggdraw
using the same fill. As if you stitch two tiles together and then brush over the final layer of paint.Try setting the
bg =
argument topng()