增加tableGrob列标题大小和单元格大小

时间:2018-02-22 14:40:46

标签: r gridextra grob

有没有办法在tableGrob项目中增加列名称的单元格?

library(grid)
d <- head(iris, 3)
g <- tableGrob(d)
grid.newpage()
grid.draw(g)

默认:

enter image description here

我想要实现的目标(这是在photoshop中完成的): enter image description here

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:3)

您可以通过更改paddingcolhead的{​​{1}}来完成此操作。

例如

theme

要了解您可以更改的内容,您可以在终端中查看thm <- ttheme_default(colhead = # first unit is the wdith, and second the height list(padding=unit.c(unit(4, "mm"), unit(10, "mm")))) tableGrob(d, theme=thm)