My question relates to the answer by Baptiste that you can find here: https://stackoverflow.com/a/18667413/2072440.
That code does pretty what I want it to do. I would like to make two modifications. First, I would like to align the text in the first column to the left. Second, I would like to change the font of the text.
I have tried to edit the line that describes the fill for the cells' background but that does not seem to impact the font and it only impacts the position of the boxes itself rather than the text in them.
Thank you.
I've added a table function in gtable, with more options.
It's really slow, unfortunately (and unsurprisingly for grid graphics).
It would be useful to review how the grid system works, in particular look at
?grid.text
. The grid system saves its plot object in 'grobs' (graphical-objects). I discovered a bit to my surprise that the "justification" is backwards to what I expected (and it is referenced to the centerline rather than the edges of a cell). If you run this code on the"g"
-object from the page you cited you might be expecting the text to move to the right, while it actually moves to the left.In order to change the font you would need to set gp node of the "x" argument to a be a list with a different structure (different than just an empty list). See `?gpar' for the arguments it accepts:
Or use the fontsize argument:
To change the justification for the gtable object one can "adjust" the
$x
element within the grob: