proplot icon indicating copy to clipboard operation
proplot copied to clipboard

Colorbars/legends spanning arbitrary contiguous subplots

Open lukelbd opened this issue 3 years ago • 0 comments

In an upcoming version I'd like to support "outer" colorbars and legends spanning arbitrary contiguous subplots -- not just "figure-wide" colorbars along the figure edge. Here's a matplotlib example from this page (the top-left colorbar is what I'm thinking of... except as before, proplot would preserve colorbar widths and subplot aspect ratios):

tmp

This shouldn't be too hard to implement, and will have the benefit of unifying the clunky internal implementation of "axes-type" and "figure-type" colorbars and legends.

This is also an area where SubplotGrid could really start to shine -- similar to SubplotGrid.format, which calls figure.format(axs=axs) using the axes in the grid, I can implement SubplotGrid.colorbar and SubplotGrid.legend that respectively call figure.colorbar(axs=axs) and figure.legend(axs=axs). This would be really succinct and intuitive -- for example, if someone has a 2-row, 3-column figure, then to draw a bottom colorbar spanning the top and bottom rows, the syntax would be axs[0, :].colorbar(m, loc='bottom') followed by axs[1, :].colorbar(loc='bottom').

lukelbd avatar Jan 27 '22 08:01 lukelbd