Nitin Mishra
Nitin Mishra

Reputation: 11

How to vertical align inside text of tableGrob R

Whenever i am using tableGrob in R, i am unable to vertically align inside text of cell, column & Row, but for horizontally the option is present, core.just = "left"...

Is there anyway to vertically align the text, because it always come in centre.

Upvotes: 1

Views: 891

Answers (1)

baptiste
baptiste

Reputation: 77096

Directly adapted from the new vignette,

library(gridExtra)
tt1 <- ttheme_default()
tt2 <- ttheme_default(core=list(fg_params=list(vjust=1, y=0.9)))
tt3 <- ttheme_default(core=list(fg_params=list(vjust=0, y=0.1)))

grid.arrange(
  tableGrob(mtcars[1:4, 1:3], rows=NULL, cols=NULL, theme=tt1),
  tableGrob(mtcars[1:4, 1:3], rows=NULL, cols=NULL, theme=tt2),
  tableGrob(mtcars[1:4, 1:3], rows=NULL, cols=NULL, theme=tt3),
  nrow=1)

enter image description here

Upvotes: 4

Related Questions