Closed wch closed 5 years ago
This is the change to [.gtable
that will implement the new behavior:
- keep <- x$layout$t %in% rows & x$layout$b %in% rows &
- x$layout$l %in% cols & x$layout$r %in% cols
+ # Figure out which grobs to keep or drop
+ keep <- logical(nrow(x$layout))
+ for (k in seq_len(nrow(x$layout))) {
+ # Keep a grob only if we're keeping all the rows from top:bottom
+ # and all the cols from left:right
+ keep[k] <- all(x$layout$t[k]:x$layout$b[k] %in% rows) &&
+ all(x$layout$l[k]:x$layout$r[k] %in% cols)
+ }
This appears to be the expected behavior, but the expected behavior can lead to problems when using grobs with a fixed size.
Here are some examples of grobs with non-fixed size -- it looks OK:
So far, so good. But what happens if the grobs have a fixed dimension?
It might be better to drop spanning grobs when any cell in the span is dropped. The fix is simple (I already have the code) but I'd like to get feedback first.