gridExtra 2.0.0 change title size

北城以北 提交于 2019-11-30 11:50:08
rolyat

First, import the package grid with either library() or require(). Second, change main to top in your code.

See below:

library(grid)

 grid.arrange(a, b, c, d,ncol=2, 
     nrow=2, top=textGrob("Title", gp=gpar(fontsize=15,font=8)))

I ran into a similar issue with gridExtra v2.0.0, receiving the following error:

Error in arrangeGrob(...) : could not find function "textGrob"

indicating that grid wasn't loaded as a dependency for gridExtra. I resolved it by requiring or importing the library grid by either:require(grid) or library(grid).

Hope that helps.

Short answer: the title is now set with top = textGrob("Title")

Short explanation: the original argument names were all over the place ("main", "sub", "legend"(!), "left"), so this update brought more consistency (top/bottom/right/left).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!