Trim off empty cells.
gtable_trim(x)
x | a gtable object |
---|
library(grid) rect <- rectGrob(gp = gpar(fill = "black")) base <- gtable(unit(c(2, 2, 2), "cm"), unit(c(2, 2, 2), "cm")) center <- gtable_add_grob(base, rect, 2, 2) plot(center)plot(gtable_trim(center))plot(gtable_trim(col))plot(gtable_trim(row))