Reputation: 351
I would like to add a custom table (or text) to the top-right corner of the following plot:
so it looks like this:
I have tried to use
annotation_custom(tableGrob(mynames), xmin=-1, xmax=7, ymin=0, ymax=-1)
but it adds the table on top of the plot area and I cannot move it to the top-right corner (above "Legend").
Any suggestions?
Upvotes: 1
Views: 1461
Reputation: 351
Thanks to @infominer I found the solution. This did the trick:
ggpl <- ggplot(...)
tableNames <- tableGrob(printNodes)
grid.arrange(ggpl, tableNames, ncol=2, main="Monthly Data")
The idea is that instead of using annotation_custom()
add text to a graphic device in the Grid graphics framework.
Upvotes: 1