-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Ignore pos in StrCategoryFormatter.__call__ to display correct label in the preview window #16006
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
Ignore pos in StrCategoryFormatter.__call__ to display correct label in the preview window #16006
Conversation
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.
Thanks for the PR! This looks good to me, would be good to add another test as I've suggested.
assert ax.yaxis.major.formatter(i+1, i+1) == "" | ||
assert ax.yaxis.major.formatter(0, None) == "" | ||
assert ax.yaxis.major.formatter(i) == d | ||
assert ax.yaxis.major.formatter(i+1) == "" |
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.
Could you add a test that ax.yaxis.major.formatter(i, None)
gives d
as the label? (which it wouldn't do before this fix)
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.
Thanks, I have updated the test.
Thanks :) |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
…ll__ to display correct label in the preview window Ignore pos in StrCategoryFormatter.__call__ to display correct… (matplotlib#16006) Ignore pos in StrCategoryFormatter.__call__ to display correct label in the preview window Conflicts: lib/matplotlib/tests/test_category.py - collision with py2 removal work (_to_str)
…-v3.2.x Backport PR #16006: Ignore pos in StrCategoryFormatter.__call__ to di…
Fixes #14881
The position pos in
__call__
can be ignored as the tick label is independent of position. So,__call__(value, None)
would return a category label even if pos isNone
, which is the expected behavior.The test case has been modified to pass only a single argument (so pos defaults to
None
).