FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Deprecate auto-removal of overlapping Axes by plt.subplot{,2grid}. by anntzer · Pull Request #22418 · matplotlib/matplotlib · GitHub

Repository navigation

Deprecate auto-removal of overlapping Axes by plt.subplot{,2grid}. - #22418

Merged
jklymak merged 1 commit into
matplotlib:mainfrom
anntzer:ov
Mar 29, 2022
Merged

jklymak merged 1 commit into
matplotlib:mainfrom
anntzer:ov

Conversation

anntzer commented Feb 6, 2022

Copy link
Copy Markdown
Contributor

In particular, note that the OO add_subplot does not have this behavior.

Closes #4976. Closes #11435 (which was deemed "not a bug", but still...)

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If something is intentionally built in, there's usually a reason. Do have an idea why people might want to replace fully overlapped axes? Is this maybe MATLAB behavior?

I agree that this behavior is quite unexpected, and I'm +0.8 on removing. I just want to make sure we're not busting a valid use case. While you can remove fully overlapping axes manually, that's quite a bit of an effort, in particular if you come from the "simple" pyplot interface. The alternative to a full deprecation would be to make this configurable via a parameter and migrate the default to not removing.

anntzer commented Feb 10, 2022

Copy link
Copy Markdown
Contributor Author

I don't think it comes from MATLAB (#7377 (comment))

jklymak commented Feb 10, 2022

Copy link
Copy Markdown
Member

90% Matlab does this if the subplot slot is the same. I think it even does it if the subplot slots overlap. What it does not do is check for overlaps of manually placed axes.

anntzer commented Feb 10, 2022

Copy link
Copy Markdown
Contributor Author

Ah, good catch, I just check that it does...

anntzer added the status: needs comment/discussion needs consensus on next step label Feb 10, 2022

jklymak commented Feb 10, 2022

Copy link
Copy Markdown
Member

OTOH my comment wasn't in favour of keeping the Matlab behavior and I was 95% sure we had already deprecated it? Maybe we reverted it as too intrusive?

anntzer commented Feb 10, 2022

Copy link
Copy Markdown
Contributor Author

I don't think(?) we deprecated that before.

ax = plt.subplot(1, 2, 1)
ax1 = plt.subplot(1, 2, 1)
ax2 = plt.subplot(1, 2, 2)
# This will delete ax / ax1 as they fully overlap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

At least one should be kept and the warning captured.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

sure

QuLogic commented Mar 22, 2022

Copy link
Copy Markdown
Member

It appears tests don't like it?

In particular, note that the OO add_subplot does not have this behavior.

anntzer commented Mar 23, 2022

Copy link
Copy Markdown
Contributor Author

oops, should be fixed.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs comment/discussion needs consensus on next step

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plt.subplot eats my subplots missing imshow() subplots when using tight_layout()

4 participants


Back | FazBrowse Home | New Git URL