[英]gridExtra 2.0.0 change title size
I know that gridExtra has been updated. 我知道gridExtra已经更新。 As a result, I'm left wondering how to change title sizes. 结果,我想知道如何更改标题大小。 This no longer works 这不再有效
grid.arrange(a, b, c, d,ncol=2,
nrow=2, main=textGrob("Title", gp=gpar(fontsize=15,font=8)))
That no longer works, the option for main has been changed to top but I can't figure out the textGrob features to alter the font size). 这不再有效,main的选项已经改为top但我无法弄清楚textGrob功能来改变字体大小)。 Any clues? 有线索吗? Thanks 谢谢
First, import the package grid
with either library()
or require()
. 首先,使用library()
或require()
导入包grid
。 Second, change main
to top
in your code. 其次,在代码中将main
改为top
。
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: 我遇到了与gridExtra v2.0.0
类似的问题,收到以下错误:
Error in arrangeGrob(...) : could not find function "textGrob" arrangeGrob(...)出错:找不到函数“textGrob”
indicating that grid wasn't loaded as a dependency for gridExtra
. 表示未将网格加载为gridExtra
的依赖gridExtra
。 I resolved it by requiring or importing the library grid
by either: require(grid)
or library(grid)
. 我通过以下任一方式要求或导入库grid
来解决它: require(grid)
或library(grid)
。
Hope that helps. 希望有所帮助。
Short answer: the title is now set with top = textGrob("Title")
简答:标题现在设置为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). 简短说明:原始参数名称遍布各处(“主”,“子”,“图例”(!),“左”),因此此更新带来了更多的一致性(上/下/右/左)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.