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

Use FixedFormatter only with FixedLocator by timhoffm · Pull Request #15507 · matplotlib/matplotlib · GitHub

Repository navigation

Use FixedFormatter only with FixedLocator - #15507

Merged
anntzer merged 1 commit into
matplotlib:masterfrom
timhoffm:fixed-formatter
Dec 30, 2019
Merged

anntzer merged 1 commit into
matplotlib:masterfrom
timhoffm:fixed-formatter

Conversation

timhoffm commented Oct 24, 2019 •
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

This PR prevents users from stumbling into #7122, #8779, #15501.
It does not technically fix them, FixedFormatter has a one-off bug with locators other than FixedLocator. But setting fixed labels at unknown positions is anyway not a good idea. So even if the one-off bug was fixed FixedFormatter should only used with FixedLocator.

  • This PR mostly documents that FixedFormatter should not be used without a FixedLocator (along the hierarchy of tick label setter methods).
  • Additionally it warns on the lowest level set_major/minor_formatter() if a FixedFormatter is set without a FixedLocator. This may be debatable.
    One could set the formatter first and the locator afterwards, which would technically yield the correct result. However, I feel that setting the position first and the labels second is the natural way, and is actually done throughout the library.
    No alternative: Since Formatters don't know about Locators FixedFormatter itself cannot check at runtime and we have to resort to this somewhat clumsy approach.
    And I strongly want some feedback on this potential problem from running code, because nobody reads the docs 😄.
  • One could consider captureing and re-emitting warnings on the higher levels with more appropriate messages, but I felt this was too much fuss.

tacaswell added this to the v3.3.0 milestone Oct 25, 2019

Copy link
Copy Markdown
Member

Seems reasonable, but fails 15 tests!

timhoffm force-pushed the fixed-formatter branch 2 times, most recently from 4f9a9fe to 332cb4a Compare October 27, 2019 21:02
timhoffm added API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … status: needs review labels Oct 28, 2019
Comment thread lib/matplotlib/axis.py Outdated

jklymak commented Nov 1, 2019

Copy link
Copy Markdown
Member

TypeError: _warn_external() got an unexpected keyword argument 'stacklevel' 😉

Comment thread lib/matplotlib/axis.py Outdated
timhoffm force-pushed the fixed-formatter branch 2 times, most recently from 578236a to 29b63c7 Compare November 1, 2019 17:39
Comment thread lib/matplotlib/axes/_base.py Outdated
anntzer previously approved these changes Dec 2, 2019

anntzer left a comment

Copy link
Copy Markdown
Contributor

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

just one nit

Comment thread lib/matplotlib/axis.py Outdated
anntzer dismissed their stale review December 2, 2019 18:30

actually a real (minor) thing to fix on the warning too

timhoffm force-pushed the fixed-formatter branch 2 times, most recently from 8481e72 to a473ba1 Compare December 3, 2019 05:17

Copy link
Copy Markdown
Member Author

Ping @anntzer warning fixed.

anntzer merged commit 642b034 into matplotlib:master Dec 30, 2019
timhoffm deleted the fixed-formatter branch December 30, 2019 17:15
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

API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, …

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL