如何将颜色更改为textGrob项目

时间:2018-02-22 08:38:24

标签: r colors title gridextra grob

我正在尝试更改标题的背景颜色。我已按照此代码生成了在new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='fa fa-2x sidebar-button pull-left fa-bars' and starts-with(@ng-class,'activeLeft')]"))).click(); 之上添加标题的结果。但是,未启用填充选项。 R(v3.2.5)中未发布任何警告或错误。

tableGrob

我需要用白色粗体字母和黑色背景标题。

非常感谢任何帮助。谢谢。

1 个答案:

答案 0 :(得分:2)

@ user20650给出的解决方案:

将文字写在黑色矩形上:title <- grobTree( rectGrob(gp=gpar(fill="black")), textGrob("Testing title background", gp=gpar(fontsize=15, col="white", fontface="bold")))(并使用grid.draw)