You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran across this while working on tidyverse/ggplot2#2810. It seems as though the gtable $grobs element is assumed to be a list of grobs, as the print() and grid.draw() methods fail if any of these elements are NULL. However, they are not checked by gtable_add_grob() when grobs is a list. This makes it difficult to debug, as the errors are delayed until render time.
gt<-gtable::gtable(
widths=grid::unit(1, "null"),
heights=grid::unit(1, "null")
)
# correctly identified as not a grobgtable::gtable_add_grob(gt, NULL, 1, 1, 1, 1)
#> Error: grobs must either be a single grob or a list of grobs# creating this gtable is finegt_null<-gtable::gtable_add_grob(gt, list(NULL), 1, 1, 1, 1)
# ...but nothing can be done with it
print(gt_null)
#> TableGrob (1 x 1) "layout": 1 grobs#> Error in vapply(x$grobs, as.character, character(1)): values must be length 1,#> but FUN(X[[1]]) result is length 0grid::grid.draw(gt_null)
#> Error in gList(structure(list(wrapvp = structure(list(x = structure(0.5, class = "unit", valid.unit = 0L, unit = "npc"), : only 'grobs' allowed in "gList"
I ran across this while working on tidyverse/ggplot2#2810. It seems as though the gtable
$grobs
element is assumed to be a list ofgrob
s, as theprint()
andgrid.draw()
methods fail if any of these elements are NULL. However, they are not checked bygtable_add_grob()
whengrobs
is alist
. This makes it difficult to debug, as the errors are delayed until render time.Created on 2019-05-03 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: