我想在下图的右上角添加一个自定义表格(或文本):
所以它看起来像这样:
我尝试过使用
annotation_custom(tableGrob(mynames), xmin=-1, xmax=7, ymin=0, ymax=-1)
但它将表格添加到绘图区域的顶部,我无法将其移动到右上角(上方"图例")。
有什么建议吗?
答案 0 :(得分:1)
感谢@infominer我找到了解决方案。这就是诀窍:
ggpl <- ggplot(...)
tableNames <- tableGrob(printNodes)
grid.arrange(ggpl, tableNames, ncol=2, main="Monthly Data")
我们的想法是,不要使用annotation_custom()
向Grid图形框架中的图形设备添加文本。