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

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

Already on GitHub?Sign in to your account

Merged
ksunden merged 10 commits intomatplotlib:mainfromdoronbehar:tickerEngOffset
Oct 30, 2024

Conversation

doronbehar
Copy link
Contributor

PR summary

Solve#28463 by makingticker.EngFormatter be a subclass ofticker.ScalarFormatter (and not uponticker.Formatter).

PR checklist

@tacaswelltacaswell added this to thev3.10.0 milestoneJul 3, 2024
@doronbehar
Copy link
ContributorAuthor

Thanks for all the suggestions! I hope the documentation related comments will come out OK.

@doronbehardoronbeharforce-pushed thetickerEngOffset branch 2 times, most recently from696f0b1 toa2c766bCompareJuly 3, 2024 20:11
@doronbehar
Copy link
ContributorAuthor

The last commit changes this:

Figure_1

Into this:

Figure_1

@tacaswell
Copy link
Member

Does that change the behavior when the user does not opt-in to using offsets?

@doronbehar
Copy link
ContributorAuthor

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 theENG_PREFIXES that can shorten the strings of the ticks. Hence I managed to further simplify the logic inEngFormatter such thatself.orderOfMagnitude is always 0, and the offset text only shows offset prefixed with+, and not showing the oom of the data after offset subtraction.

The only debatable drawback of this behavior, is that a0 tick will always appear without a unit prefix. It sort of makes sense because 0 is 0 no matter what is the data's general oom. I got convinced after playing a bit, that making sure that all ticks have the same unit prefix is making the class so much more complex that it doesn't worth it. The current behavior is consistent and well tested.

The last force push simplifies as described above, and improves the test I added for this feature.

@doronbehar
Copy link
ContributorAuthor

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

image

+/- 3.1e3

image

+/- 2.1e5

image

Also it is automatically updated when zooming in

image

Offset 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)

image

@github-actionsgithub-actionsbot added the Documentation: examplesfiles in galleries/examples labelJul 4, 2024
@doronbehar
Copy link
ContributorAuthor

I almost lost in the rebase the fixes to the comments mentioned above. They are fixed now. Hopefully docs will build fine now 🙏.

@doronbehar
Copy link
ContributorAuthor

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.

@ksundenksunden reopened thisOct 9, 2024
Copy link
Member

@QuLogicQuLogic left a 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.

Copy link
Member

@QuLogicQuLogic left a 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.

@doronbehar
Copy link
ContributorAuthor

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.

@doronbehardoronbeharforce-pushed thetickerEngOffset branch 2 times, most recently from2646527 to1290331CompareOctober 13, 2024 09:52
@doronbehar
Copy link
ContributorAuthor

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 withpytest --showlocals, and meaning ofoom_ variables in thetest_engformatter_offset_oom, and:

`matplotlib.ticker.EngFormatter`

v.s

:class:`matplotlib.ticker.EngFormatter`

In the docs (not in the titles of documents - that's understandable).

@doronbehar
Copy link
ContributorAuthor

doronbehar commentedOct 13, 2024
edited
Loading

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.

@QuLogic
Copy link
Member

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 currentmain.

@doronbehar
Copy link
ContributorAuthor

Rebased.

@doronbehar
Copy link
ContributorAuthor

Less errors now, but I see now:

Path does not exist: /Users/runner/work/1/s/result_images

Comment on lines 1644 to 1646
# 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.
Copy link
Member

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.

Copy link
ContributorAuthor

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?

@doronbehar
Copy link
ContributorAuthor

The mypy CI error doesn't seem related to the PR...

@ksunden
Copy link
Member

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.

@ksundenksunden merged commit61833b8 intomatplotlib:mainOct 30, 2024
42 of 43 checks passed
@doronbehar
Copy link
ContributorAuthor

Thank you for your corporation :).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@story645story645story645 left review comments

@ksundenksundenksunden left review comments

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Labels
Projects
Milestone
v3.10.0
Development

Successfully merging this pull request may close these issues.

5 participants
@doronbehar@tacaswell@story645@ksunden@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp