Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move label hiding rectilinear-only check into _label_outer_{x,y}axis.#21317

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:mainfromanntzer:lop
Nov 11, 2021

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedOct 8, 2021
edited
Loading

This allows having it both in subplots() (which had that check before)
and in subplot_mosaic (which didn't, see test). (All Axes returned by
subplots() have the same projection, soall(ax.name == "rectilinear")
can be replaced by independently checking each Axes.)

xref#19994, again this may mess up some third-party axes (#19994 (comment)) but the tradeoff seemed OK back then. (We can always consider adding a "does this want to participate in label_outer" flag if there's demand for it, but let's not overengineer things for now.)

Edit, following review: Also improve the rectilinearity check by testing the shape of the axes
patch instead (so that e.g. skewT also participates in
outer-only-labels), and add an escape hatch so that Axes.label_outer
always does "what it says on, the tin".

PR Summary

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@@ -396,10 +396,15 @@ def test_remove_shared_polar(fig_ref, fig_test):

def test_shared_polar_keeps_ticklabels():
fig, axs = plt.subplots(
2, 2, subplot_kw=dict(projection="polar"), sharex=True, sharey=True)
2, 2, subplot_kw={"projection": "polar"}, sharex=True, sharey=True)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this is just to make things fit in 79 characters in the equivalent expression below.

@dstansby
Copy link
Member

I'm pro making the change in#19994, since that's a function that sets up axes, but I'm against making the change here:

  • For some non-rectilinear Axes (SkewT (https://matplotlib.org/stable/gallery/specialty_plots/skewt.html) was an example given before) this behaviour is desirable, but with this patchlabel_outer stops working
  • For other non-rectilienar Axes (e.g. polar) I agree this doesn't make sense, but what's the use case for callinglabel_outer then? At least as it islabel_outer does what it says on the tin, instead of silently doing nothing for a set of polar axes.

@anntzer
Copy link
ContributorAuthor

I agree with your points. The original motivation was to prepare work on#18305. However, I changed this PR on two points to address your comments:

  • rectilinear-only detection is now a bit more general; now, any axes whoseax.patch is a Rectangle (i.e., also including skewT) participates in outer-only labeling.
  • label_outer now always does "what it says on the tin", i.e. switch labels regardless of the axes projection. The rectilinear (now rectangular) detection now only affects subplots() and subplot_mosaic().

This allows having it both in subplots() (which had that check before)and in subplot_mosaic (which didn't, see test).  (All Axes returned bysubplots() have the same projection, so `all(ax.name == "rectilinear")`can be replaced by independently checking each Axes.)Also improve the rectilinearity check by testing the shape of the axespatch instead (so that e.g. skewT also participates inouter-only-labels), and add an escape hatch so that Axes.label_outeralways does "what it says on, the tin".
@QuLogic
Copy link
Member

This reverts a bit of#19994, in that it's disabled only for the relevant Axes and not all. Since that's not released, should we trying to put this (or something similar) in 3.5?

@anntzer
Copy link
ContributorAuthor

I'm not sure how many people this actually affects, but yes, this prevents a regression on skewT-type shared axes in 3.5, so if you can still squeeze this in, that would be a good idea.

@QuLogicQuLogic added this to thev3.5.0 milestoneNov 2, 2021
@tacaswelltacaswell merged commit29a3707 intomatplotlib:mainNov 11, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestNov 11, 2021
@anntzeranntzer deleted the lop branchNovember 11, 2021 20:17
tacaswell added a commit that referenced this pull requestNov 12, 2021
…317-on-v3.5.xBackport PR#21317 on branch v3.5.x (Move label hiding rectilinear-only check into _label_outer_{x,y}axis.)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@dstansby@QuLogic@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp