-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ticker.EngFormatter: allow offset #28495
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
Conversation
1856a02
to
80dca54
Compare
ffe8914
to
dc1fde0
Compare
dc1fde0
to
f651b73
Compare
Thanks for all the suggestions! I hope the documentation related comments will come out OK. |
696f0b1
to
a2c766b
Compare
Does that change the behavior when the user does not opt-in to using offsets? |
OK so after thinking about it once more, I realized that what I implemented in the demo at #28463 may be too complex - there is no need to show an order of magnitude of the data at the offset text, if we already have the The only debatable drawback of this behavior, is that a The last force push simplifies as described above, and improves the test I added for this feature. |
93cfbcf
to
2f43894
Compare
OK so after testing many more edge cases, I revised the behavior of this I changed my opinion once more. The tests now are much more extensive and I finally managed to reach the behavior I was aiming for. The git history got too messy and I had a few reverts locally so I forced push. Here are a few screenshots: +/-0.5e6+/- 3.1e3+/- 2.1e5Also it is automatically updated when zooming inOffset enabled in principal, but data doesn't qualify to get an offset:(Also when started like that, offset is computed automatically and presented if needed) |
2f43894
to
859ec58
Compare
I almost lost in the rebase the fixes to the comments mentioned above. They are fixed now. Hopefully docs will build fine now 🙏. |
859ec58
to
6a24602
Compare
I'm having some trouble building the documentation locally, so I have to rely upon CI. Last force push fixed a few small issues with it. |
6a24602
to
c841808
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor stuff, but a couple of small implementation questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forgot to check the tests.
Thank you @QuLogic for the detailed review! I don't have time now to respond to all of your suggestions, so I started with the easier parts, documentation and comments. |
2646527
to
1290331
Compare
OK so last night I struggled a bit running the tests locally, so I hoped my changes would just work. Now I finally checked locally before pushing. I also responded to all other comments, and the topics left to discuss are the local variables helping to debug with `matplotlib.ticker.EngFormatter` v.s :class:`matplotlib.ticker.EngFormatter` In the docs (not in the titles of documents - that's understandable). |
I don't understand the circle CI errors... They don't seem related to my changes. Same with the errors on Windows and MacOS on Azure. |
It appears you have rebased against a very old commit instead of the current |
1290331
to
b7be421
Compare
Rebased. |
Less errors now, but I see now:
|
lib/matplotlib/tests/test_ticker.py
Outdated
# These prefix_ variables are used only once, so we could have inlined | ||
# them all, but it is more comfortable in case of tests breakages to | ||
# view their values with pytest --showlocals. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That pytest's assertion rewriting isn't showing you a breakdown of the results is a bug, and --showlocals
is a reasonable workaround, but I wouldn't leave a comment about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That pytest's assertion rewriting isn't showing you a breakdown of the results is a bug, and
--showlocals
is a reasonable workaround, but I wouldn't leave a comment about it.
What do you mean by pytest's assertion rewriting?
Allows us to use many order of magnitude and offset related routines from ScalarFormatter, and removes a bit usetex related duplicated code. Solves matplotlib#28463.
a814447
to
b2c35fa
Compare
The mypy CI error doesn't seem related to the PR... |
Mypy passes locally, CI failure was fixed by #29014, would need a rebase to resolve on CI, butr since it passes locally and the failure is understood, I'm satisfied. |
Thank you for your corporation :). |
PR summary
Solve #28463 by making
ticker.EngFormatter
be a subclass ofticker.ScalarFormatter
(and not uponticker.Formatter
).PR checklist