thomasp85 / patchwork

The Composer of ggplots
https://patchwork.data-imaginist.com
Other
2.42k stars 157 forks source link

A function like get_max_dim() but for comparing plot_dimension objects? #332

Open thomasggodfrey opened 10 months ago

thomasggodfrey commented 10 months ago

I have a project with multiple scripts that produces a lot of plots at different points, in different scripts. I'm currently aligning plots produced 'within scripts' but not 'between scripts'. If I want to align the plots 'between scripts', I will need to re-import them all at once and then use get_max_dim() and set_dim, or align_patches(), to find and set each of them to the dimensions of the largest plot.

I was thinking it might be useful to have a function that can compare plot_dimension objects and 'get the max' dim from a set of plot dimension objects. Then you could save out the max dims within each script and compare those, rather than the plots themselves. You would still have to think carefully about your workflow and how to use the 'final max dim' object to set dimensions of all your plots, but it might make for cleaner code/a cleaner structure to your project to have a get_max_dims function for comparing plot_dimension objects.

thanks for all your hard work on the package, Tom