proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.11k stars 102 forks source link

[Feature request] span axis labels #464

Open cvanelteren opened 1 month ago

cvanelteren commented 1 month ago

Description

I often have the issue where the axes are not shared, but I do want to share the labels. For example when I am mixing some axes and not others. I propose to add a feature where you can specify the sharing of the axis. As far as I am aware this is not available in proplot. Currently I resort to something like


def add_main(fig, nrows, ncols, span):
 main = fig.add_subplot(nrows, ncols, span)
 main.set_facecolor("none")
 main.set_xticks([])
 main.set_yticks([])
 for spine in main.axes.spines.values():
     spine.set_visible(False)
 return main

fig, ax = plt.subplots(ncols = 2, nrows = 2, share = 0)
main_top = add_main(fig, 2, 2, (1, 2))
main_top.set_xlabel("group 1", labelpad = 25)
main_top.set_ylabel("group 1", labelpad = 25)

main_bottom = add_main(fig, 2, 2, (3, 4))
main_bottom.set_xlabel("group 2", labelpad = 25)
main_bottom.set_ylabel("group 2", labelpad = 25)

fig.show()

Resulting in image

Some of it can be achieved with fig labels. If this can already be achieved, we could add it to the docs, if not we can add it.