proplot icon indicating copy to clipboard operation
proplot copied to clipboard

Add function for "concatenating" figures

Open lukelbd opened this issue 5 years ago • 2 comments

Problem

It is quite common to want separate figure-files for individual subplots along with a single larger figure containing the exact same subplots in a grid. In matplotlib, there is currently no good way to do this. This stackoverflow answer suggests defining separate functions that accept an axes and do all the plotting, but a more intuitive way would be nice:

Solution

At some point I would like to add a pplt.concatenate_figs function used for "concatenating" smaller figures (usually, but not necessarily, containing just one subplot) into larger figures with multiple subplots. Users should be able to pass lists of axes and have proplot concatenate them along rows or columns with e.g. pplt.concatenate_figs(..., rows=True|False), or pass lists of lists of subplots in which case they are concatenated according to this 2D layout.

This shouldn't be very difficult to code, but I might need to wait for #110 to finish.

lukelbd avatar Jul 07 '20 20:07 lukelbd

Matplotlib now has this possibly-related "subfigures" feature but I think the goals of that feature are different from what I'm proposing here.

It doesn't look like "subfigures" can be saved independently -- it looks like their idea is mostly to have independent gridspec layouts and axes styles, both of which are possible in proplot using format with e.g. ax.format(style=local_style) or by using gridspecs with different row/column spacings e.g. pplt.GridSpec(wspace=[1, 2]). So the feature proposed here is definitely still worth doing.

lukelbd avatar Aug 22 '21 20:08 lukelbd

(If it's not an appropriate post, please feel free to delete it.) Thank you for developing the awesome library. In particular, I'm impressed with the local formatting function for each subplot. By the way, I have recently developed a new subplot manager, "patchworklib", that allows users to quickly arrange multiple matplotlib plots with only "|" and "/" operators. Then, I thought the patchworklib implementation may help realize the function suggested in the issue. If you are interested in patchworklib, I'm thinking of optimizing patchworklib for the proplot system. If you have any advice or ideas, please let me know.

ponnhide avatar Jan 29 '22 16:01 ponnhide