r-lib / gtable

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

Fix aspect ratio for only part of a gtable #47

Closed thomasp85 closed 5 years ago

thomasp85 commented 9 years ago

Currently it seems like the only way to fix the aspect ratio of a gtable object is with the $respect element, which is a global parameter. This is problematic in cases where a gtable includes both graphics that needs a fixed aspect ratio and some that should fill out the area. My particular use case is stacking a polar coordinate plot with a regular cartesian coordinate plot. Either the former have a stretched appearance or the latter is confined to a quadratic drawing area.

It would be nice if the respect element was a boolean vector with an element for each grob in the gtable instead of a global option.

thomasp85 commented 5 years ago

Closing. Current approach makes sense as it references the aspect.ratio of the full gtable, and not of the individual cells. To create custom aspect.ratios inside cells, modify the grobs in the cells directly