Closed wch closed 5 years ago
These two blocks of code should give the same result for dimnames(gt), but they don't:
dimnames(gt)
g <- rectGrob() grobmat <- matrix(list(g,g,g,g,g,g), nrow=2, dimnames = list(yname = letters[1:2], xname = LETTERS[1:3])) gt <- gtable_matrix("test", grobmat, widths=unit(c(1,2,3),"cm"), heights=unit(c(1,2),"cm")) dimnames(gt) # [[1]] # NULL # [[2]] # NULL grobmat <- matrix(list(g,g,g,g,g,g), nrow=2) gt <- gtable_matrix("test", grobmat, widths=unit(c(1,2,3),"cm"), heights=unit(c(1,2),"cm")) dimnames(gt) <- list(yname = letters[1:2], nname = LETTERS[1:3]) dimnames(gt) # [[1]] # [1] "a" "b" # [[2]] # [1] "A" "B" "C"
The same should also work for gtable_col and gtable_row:
gtable_col
gtable_row
groblist <- list(a=g, b=g, c=g) gt <- gtable_row("test", groblist) dimnames(gt) # [[1]] # NULL # [[2]] # NULL ## The above code _should_ give the same result as this: groblist <- list(g,g,g) gt <- gtable_row("test", groblist) dimnames(gt) <- list(c("a", "b", "c"), NULL) dimnames(gt) # [[1]] # [1] "a" "b" "c" # [[2]] # NULL
Although it's not clear how the [[2]] dimension name should be set in this case.
[[2]]
These two blocks of code should give the same result for
dimnames(gt)
, but they don't:The same should also work for
gtable_col
andgtable_row
:Although it's not clear how the
[[2]]
dimension name should be set in this case.