r-lib / gtable

The layout packages that powers ggplot2
https://gtable.r-lib.org
Other
87 stars 18 forks source link

arranging grobs with basic layout (ncol/nrow) #42

Closed baptiste closed 8 years ago

baptiste commented 11 years ago

Suggestion for a new function gtable_arrange reproducing the basic functionality of gridExtra::grid.arrange() with gtable, with added benefits that the resulting gtable can be further edited.

The difference with the existing gtable_matrix is two-fold: i) the grobs are passed as a list, and either ncol/nrow is passed as an argument, or guessed from sensible defaults; ii) the number of grobs can be <= nrow * ncol, i.e. there can be empty cells in the table.

A basic example is here: http://rpubs.com/baptiste/gtable_arrange

baptiste commented 11 years ago

alternatively, the user could provide a matrix indicating the layout. Here's a sketch: http://stackoverflow.com/a/18451562/471093

kohske had some related code, also checking for legit layout (no holes, etc): https://github.com/hadley/ggplot2/issues/326 I don't remember what happened to this proposal, but I don't think it was ported in gtable when it became a separate package.

baptiste commented 8 years ago

that's now done in gridExtra