更改grid.arrange输出的背景颜色 [英] change the background color of grid.arrange output

查看:154
本文介绍了更改grid.arrange输出的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用来自 gridExtra 包的 grid.arrange 将两个图形放在一个页面上并保存为PNG文件。我喜欢改变由 grid.arrange 生成的最终png文件的背景颜色。可能吗?

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


解决方案

尝试将 bg = 参数设置为 png() $ b

  library(gridExtra)
库(格子)

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


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)

解决方案

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()

这篇关于更改grid.arrange输出的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆