I am trying to change the background color of my title. I have followed this code which results to adding a title on top of my tableGrob
. However, the fill option is not enabled. No warning or error posted in R (v3.2.5).
d <- head(iris[,1:2])
table <- tableGrob(d, rows=NULL)
library(grid)
library(gtable)
title <- grid.text("Testing title background",gp=gpar(fontsize=15, col="white", fontface="bold", fill="black"))
table <- gtable_add_rows(table,
heights = grobHeight(title) + unit(1,"line"),
pos = 0)
table <- gtable_add_grob(table, title,
t=1, l=1,
r=ncol(table))
plot(table)
I need the title in White bold letters and in black background.
Any help is much appreciated. Thank you.