how do I get rid of random background grid from arrangeGrob

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 18:50:10
baptiste

arrangeGrob() now returns a gtable, which you should draw with grid.draw(), not plot().

grid.draw(y)

yields

To get rid of artefacts from past plots (as per above update) use grid.newpage().

Remove the nrow argument. Like so:

library(ggplot2)
p1 <- ggplot(mtcars, aes(x=factor(cyl), y=mpg)) + geom_boxplot()
p2 <- ggplot(mtcars, aes(x=factor(cyl), y=wt)) + geom_boxplot()
library(gridExtra)
y <- arrangeGrob(p1, p2, ncol = 2)
plot(y)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!