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

FIX: make MaxNLocator only follow visible ticks for order of magnitude#12086

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

Conversation

jklymak
Copy link
Member

PR Summary

Closes#12072

Order of magnitude for tick formatting in ScalarFormatter was using invisible ticks. This changes to just use visible.

Probably obviated by#11004 but won't hurt anything.

Before:

figure_2

After

figure_1

Code

importmatplotlib.pyplotaspltimportmatplotlib.tickerastickersci_nums= [10**9,8*10**9]plt.rcParams['ytick.labelsize']=13fig,ax=plt.subplots(1,2)ax[0].scatter(range(len(sci_nums)),sci_nums)ax[1].scatter(range(len(sci_nums)),sci_nums)ax[1].yaxis.set_major_locator(ticker.MaxNLocator(4))plt.show()

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@QuLogic
Copy link
Member

Seems to have broken some docs when there are no visible ticks.

jklymak reacted with thumbs up emoji

@jklymak
Copy link
MemberAuthor

Ha, it passes all oftest_axes andtest_ticker...

@jklymakjklymakforce-pushed thefix-changing-orderofmagnitude branch fromfc00626 toed1c830CompareSeptember 11, 2018 00:12
@anntzer
Copy link
Contributor

Modulo the docs...

@jklymak
Copy link
MemberAuthor

@anntzer I think the docs are OK (they say it'll just key off the data, not the data plus one tick on either side). It does need tests, which I'll do now. I actually don't understand whytest_ticker passes all the tests... It should have failed some of them. Of course the test for this is all parameterized etc, so it'll take me a bit to grok what is going on..

@jklymak
Copy link
MemberAuthor

Added test that fails master but passes this PR...

@jklymakjklymakforce-pushed thefix-changing-orderofmagnitude branch from3183f78 to9a23d6dCompareSeptember 11, 2018 17:41
@NelleV
Copy link
Member

Thanks@jklymak !
I agree that the docs don't need changing on that one, so I'll go ahead and merge.

@NelleVNelleV merged commitafda25a intomatplotlib:masterSep 14, 2018
@QuLogicQuLogic added this to thev3.1 milestoneSep 18, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.1.0
Development

Successfully merging this pull request may close these issues.

MaxNLocator changes the scientific notation exponent with different number of tick labels
4 participants
@jklymak@QuLogic@anntzer@NelleV

[8]ページ先頭

©2009-2025 Movatter.jp