[R] tableGrob and properties of a cell

Alex Bird sunduck at gmail.com
Tue Dec 7 16:53:14 CET 2010


Hello there,

  could you please help to modify gpar() properties of a cell inside
tableGrob() output.
  In the following example I want to have different color for one out of 4 cells

require(gridExtra)
z<-matrix(1:4,2,2)
grid.draw(tableGrob(z))

  The only way I found for now how to do it is to do something like this
downViewport(current.vpTree()$children[[1]]$children[[6]]$name)
grid.text('2',gp=gpar(col='red',fontface='bold'))

But for some reasons when I try to print the table into jpeg the last
grid.text() prints desired label text somewhere but not in the place I
want it to be.
Is there another more "smart" way to do it?

Thanks in advance!

Kind regards,
Alex



More information about the R-help mailing list