I have two questions
1.When I use tableGrob to set multiple row names for arrangeGrob, how can I rotate the names, I noticed someone has posted a similar question R grid.table column heading character rotation. However, I failed here
library(grid)
library(gridExtra)
gs <- lapply(1:9, function(ii)
grobTree(rectGrob(gp=gpar(fill=ii, alpha=0.5)), textGrob(ii)))
gR <- arrangeGrob(grobs=gs, ncol=4,
top="top label",
right="right label")
tt <- ttheme_default(base_size = 8,
rowhead=list(fg_params=list(rot=90)))
lt <- tableGrob(c("", "134442243", "5425376", "938372378"),
theme = tt)
cb <- cbind(lt, gR, size = "last")
grid.newpage()
grid.draw(cb)
2.When I set multiple xlabels for arrangeGrob as following, the grobs are quite narrow
tt <- ttheme_default(colhead=list(fg_params = list(parse=F)))
bt <- tableGrob(matrix(c(" 1 ", "2", "3", "4", ""),ncol = 5), theme = tt)
rb <- rbind(gR, bt, size = "last")
# the width of each grob is changed by `bt`
grid.newpage()
grid.draw(rb)
It seems each grob width is related to each xlabel width. How can I keep grob width and put xlabel at the middle bottom of grob?