Skip to content

Support simple axes shares in subplot_mosaic #18305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anntzer opened this issue Aug 20, 2020 · 9 comments · May be fixed by #26411
Open

Support simple axes shares in subplot_mosaic #18305

anntzer opened this issue Aug 20, 2020 · 9 comments · May be fixed by #26411
Labels
Good first issue Open a pull request against these issues if there are no active ones! New feature

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 20, 2020

Problem

I realized that subplot_mosaic() is quite nice even to create single row or single column layouts if you were previously going to stuff the result of subplots() in a dict anyways (or use hardcoded indices, in which case a dict may be more robust if you may (in some later iteration of the code) add axes somewhere in the middle).

(Side points: Also, this avoids running into the subtle bug, when writing axs = subplots(n), of the case n = 1 where axs is squeezed into a single axes (yes, I know, the fix is to pass squeeze=False...) Single column is slightly trickier than single row (subplot_mosaic([[name] for name in names])) but heh.).

However, subplot_mosaic() does not allow axes sharing. Yes, I've even argued against it in the original PR on the grounds of "too complicated" (#16603 (comment))...

Proposed Solution

... but we could at least support the simplest case(s), as in subplots(): sharex/sharey=True/"all" (this is completely unambiguous: share all axes -- "all" is a synonym from subplots() that we probably want to keep for consistency), and possibly "row"/"col" (I'd say two axes (which may have various spans) are in the same row for sharing purposes if they both begin on the same row and end on the same row, which seems the most useful definition)? We should be careful, when checking for True, to actually check for that value (or 1, or np.bool(True)), and not for general truthiness, so that we don't get boxed in later if we decide we do want to support passing in complex sharing specs (e.g. via dicts, as proposed in the original PR thread). (I'm still against that complexity, at least for now...)

Labeling as good first issue as I don't think there's too much complexity or API design space here, although we still need to decide whether this is a good idea or not.

Additional context and prior art

@anntzer anntzer added Good first issue Open a pull request against these issues if there are no active ones! New feature labels Aug 20, 2020
@dopplershift
Copy link
Contributor

I'm half-way tempted to remove "good first issue" until we actually decide this is a good idea...

@timhoffm
Copy link
Member

I'm ok with the proposal. It's a clear specification and can help for simple layouts. I don't expect it to be useful for really complex layout, but it would do still do something reasonable there.

@Selich
Copy link

Selich commented Sep 24, 2020

I'm currently reading the documentation and I didn't know, until now, that it does not have sharex/sharey parameters. Will look at the code a bit and send a PR if I figure it out.

Is it still ok to work on this issue?

@timhoffm
Copy link
Member

Yes, you can work on this issue. I support the sharing semantics proposed by @anntzer above.

@tacaswell tacaswell added this to the v3.4.0 milestone Sep 25, 2020
@aitikgupta
Copy link
Contributor

Hey @Selich are you still planning to work on this?

@Selich
Copy link

Selich commented Jan 8, 2021 via email

@tacaswell
Copy link
Member

Closed by #20107

@mwaskom
Copy link

mwaskom commented Oct 3, 2021

IMHO this is not fully closed because it looks like #20107 doesn't support "col"/"row" as arguments.

@anntzer anntzer reopened this Oct 3, 2021
@QuLogic QuLogic modified the milestones: v3.5.0, v3.6.0 Oct 8, 2021
@QuLogic QuLogic modified the milestones: v3.6.0, v3.7.0 Jul 8, 2022
@ksunden ksunden modified the milestones: v3.7.0, v3.7.1 Feb 14, 2023
@QuLogic QuLogic modified the milestones: v3.7.1, v3.7.2 Mar 4, 2023
@QuLogic QuLogic modified the milestones: v3.7.2, v3.7.3 Jul 5, 2023
@ketozhang
Copy link

ketozhang commented Jul 15, 2023

Can I take a stab on the remaining work (currently at SciPy 2023 sprint)?

@ketozhang ketozhang linked a pull request Jul 29, 2023 that will close this issue
5 tasks
@QuLogic QuLogic modified the milestones: v3.7.3, v3.8.0 Sep 9, 2023
@ksunden ksunden removed this from the v3.8.0 milestone Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Open a pull request against these issues if there are no active ones! New feature
Projects
None yet
10 participants