How to organize one grob object inside another using ggplot2 and gridExtra packages in r
I would like to know how to arrange one grob object (table) inside another. Consider the following example:
library(ggplot2)
library(gridExtra)
p1 <- qplot(data=mtcars, x = mpg, y = hp, facets = ~ hp, geom="point")
t1 <- tableGrob(head(mtcars))
print(arrangeGrob(p1, t1))
This gives:
What I would like to do is place the table inside another object like this:
Can this be done with gridArrange
or perhaps other methods from grid
and / or gridExtra
?
+3
source to share