4

It looks like grid.arrange() ignores the name attribute of tableGrob. Let's say I want to plot tables with titles...

baz<-lapply(seq(3),function(ii)
 tableGrob(format(matrix(runif(8),nrow=2,
    dimnames=list(LETTERS[1:2],letters[1:4])),digits=3),
    name=paste0('n',ii)));

This plots them but without titles: do.call(grid.arrange,c(baz,nrow=1))

It seems like overkill to screw around with creating lists of textGrobs, calculating their height, etc. I just want to force there to be an extra line above the header of each table, displaying the name I gave to that table. Or some built-in argument to do so.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
bokov
  • 3,444
  • 2
  • 31
  • 49
  • Seems like you'll have to evaluate things yourself. See this post from @baptiste. http://stackoverflow.com/questions/11774703/adding-text-to-a-grid-table-plot – Arun Apr 16 '13 at 20:44
  • Ah, yes, I read that one, and tried the code. Trouble is, that's for one table, and I can't figure out at which level I should have my list of tables: within `gList()`? Or each table gets its own `gList()` and `gTree()` gets a list of `gList()`s for its `children` argument? Or each table gets its own `gList() `within its own `gTree()` and `grid.arrange()` gets a list of `gTree()`s? – bokov Apr 17 '13 at 23:23
  • 1
    `grid.arrange` requires `grobs`, which can be `gTrees`. So you could first wrap each table in a `gTree` to add a title, and arrange all the `gTrees`. – baptiste Apr 18 '13 at 06:09

0 Answers0