thanks a lot for the quick answer! I think I get your point.
So is there a way to set the panel size without taking the detour over gtables? I saw you doing something like below in patchwork, but I have a hard time understanding the magic happening under the hood.
p <- ggplot(mtcars) + geom_point(aes(mpg, disp))
fwrap <- p + facet_wrap(vars(cyl))
# works nicely
p_sized <- p + patchwork::plot_layout(widths = unit(40, "mm"), heights = unit(40, "mm"))
p_sized
p_sized %>% patchwork:::plot_table('auto') %>% gtable::gtable_show_layout()
# also works nicely
# only I would like to have 40mm x 40mm for each panel in the facet_wrap
fwrap_sized <- fwrap + patchwork::plot_layout(widths = unit(40, "mm"), heights = unit(40, "mm"))
fwrap_sized
fwrap_sized %>% patchwork:::plot_table('auto') %>% gtable::gtable_show_layout()
Coming to your question: Why would one even like to do this?
When I prepare figures for print publication I usually do.
- ggplot
- adjust styling
- arrange and set panel size
- inspect result
- save to pdf
All of this is basically solved in your brilliant patchwork package.
Only one edge case is left. As mentioned above I would like to set each panel of a facet_wrap to 40mm x 40mm. It would be great if this could be done with patchwork::plot_layout()! The patchwork object is both a viable ggplot and has a way to get a proper gtable. Maybe you could give me a hint how to implement this?