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

ENH: offset parameter for MultipleLocator#25542

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 1 commit intomatplotlib:mainfromrcomer:multiple-locator-offset
Jun 3, 2023

Conversation

rcomer
Copy link
Member

@rcomerrcomer commentedMar 24, 2023
edited
Loading

PR Summary

Picked up from#21168. Adds anoffset parameter toMultipleLocator so the ticks can all be shifted by a given value.

importmatplotlib.pyplotaspltimportmatplotlib.tickerasmticker_,ax=plt.subplots()ax.plot(range(10))locator=mticker.MultipleLocator(base=3,offset=0.3)ax.xaxis.set_major_locator(locator)plt.show()

test

### To Do

1. Agree whetheroffset is the best name for the new parameter.
2. Address documentation tasks in the below checklist, but I wanted to get feedback on the principle and the parameter name before I went all in.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • [N/A] API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@rcomer
Copy link
MemberAuthor

I pushed a change without rebasing just to see what Mypy would do. It's running....

@rcomerrcomer marked this pull request as draftMarch 31, 2023 06:21
@rcomerrcomerforce-pushed themultiple-locator-offset branch from8796a8c tof386f33CompareMarch 31, 2023 18:05
@rcomer
Copy link
MemberAuthor

@ksunden could you help me decipher this Mypy failure?

@@ -53,7 +53,7 @@ def setup(ax, title):

# Index Locator
setup(axs[4], title="IndexLocator(base=0.5, offset=0.25)")
axs[4].plot(range(0, 5),[0]*5, color='white')
axs[4].plot([0]*5, color='white')
Copy link
MemberAuthor

@rcomerrcomerMar 31, 2023
edited
Loading

Choose a reason for hiding this comment

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

It's not completely obvious from looking at this example what the difference is betweenMultipleLocator andIndexLocator. But from theAPI docs it seems to me thatIndexLocator makes most sense when the axis does not have numbers associated with it. So I took out the x-values.

I clearly should have done more homework before the Thursday call, then I would have known thatoffset is already used as a locator param 🤦‍♀️

@rcomerrcomer marked this pull request as ready for reviewApril 1, 2023 07:36
@rcomer
Copy link
MemberAuthor

I think this is now ready for review. I have not [yet] added a what's new entry, as I'm still pretty unclear in general what the criteria are for deciding to do so.

@oscargus
Copy link
Member

I'm still pretty unclear in general what the criteria are for deciding to do so.

.. versionadded:: 3.8 I think (or just that it is nice to showcase some new features!).

(I happened to readhttps://matplotlib.org/stable/devel/coding_guide.html#new-features-and-api-changes the other day...)

Parameter makes sense! (Will review code when I have a bit more time.)

rcomer reacted with thumbs up emoji

@jklymak
Copy link
Member

Yes this should definitely get what's new entry

rcomer reacted with thumbs up emoji

@rcomerrcomerforce-pushed themultiple-locator-offset branch 2 times, most recently from1b82ad2 to9ae5834CompareApril 1, 2023 15:32
@rcomer
Copy link
MemberAuthor

OK thanks. What's new now added.

Co-authored-by: Ruth Comer 10599679+rcomer@users.noreply.github.com
@ksundenksunden merged commitf7524f4 intomatplotlib:mainJun 3, 2023
@rcomerrcomer deleted the multiple-locator-offset branchJune 3, 2023 07:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@ksundenksundenksunden approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.8.0
Development

Successfully merging this pull request may close these issues.

6 participants
@rcomer@oscargus@jklymak@QuLogic@ksunden@jondoesntgit

[8]ページ先頭

©2009-2025 Movatter.jp