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: formatting in LogFormatterExponent#5594

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
mdboom merged 3 commits intomatplotlib:masterfromtacaswell:fix_logformatterexponent
Dec 14, 2015

Conversation

tacaswell
Copy link
Member

The scale passed to thepprint_val method needs to also be
scaled by the log so that the range used to format the tick labels
matches the actual range of the tick labels (not the underlying values).

reported viahttp://stackoverflow.com/questions/33975758/matplotlib-logformatterexponent-e-in-the-exponent-labels-of-cbar

More coming onpprint_val

The scale passed to the `pprint_val` method needs to also bescaled by the log so that the range used to format the tick labelsmatches the actual range of the tick labels (not the underlying values).reported viahttp://stackoverflow.com/questions/33975758/matplotlib-logformatterexponent-e-in-the-exponent-labels-of-cbar
@tacaswelltacaswell added this to thenext bug fix release (2.0.1) milestoneDec 1, 2015
@tacaswell
Copy link
MemberAuthor

Sigh, meant to target this against v2.0.x, oh well.

@tacaswelltacaswell modified the milestones:next major release (2.0),next bug fix release (2.0.1)Dec 1, 2015
Makes sure that there are never trailing 'e' with no exponent.
Code used to generate the test data to establish bench mark.First print out is human-readable, second is for testingimport itertoolsimport matplotlib.ticker as mtickerimport numpy as npdomains = sorted([1e-3, 1.5e-2, 1e6, 100, 5, .5])float_values = sorted([np.pi * (10**i) for i in range(-5, 6)])int_values = sorted([1 * (10 ** i) for i in range(-5, 6)])fmt = mticker.LogFormatter()print()for d in domains:    print('Domain ', d)    for f in float_values:        print('     {: >10.7f}: {: <10}'.format(f, fmt.pprint_val(f, d)))    for f in int_values:        print('     {: >10g}: {: <10}'.format(f, fmt.pprint_val(f, d)))print()print()print(',\n'.join(['        ({v:.10g}, {d!r}, {res!r})'.format(    v=f, d=d, res=fmt.pprint_val(f, d))                  for d, f in itertools.product(                          domains, float_values + int_values)]))
@tacaswell
Copy link
MemberAuthor

Domain  0.001      0.0000314: 3.142e-5        0.0003142: 3.142e-4        0.0031416: 3.142e-3        0.0314159: 3.142e-2        0.3141593: 3.142e-1        3.1415927: 3.142          31.4159265: 3.142e1        314.1592654: 3.142e2        3141.5926536: 3.142e3        31415.9265359: 3.142e4        314159.2653590: 3.142e5             1e-05: 1e-5               0.0001: 1e-4                0.001: 1e-3                 0.01: 1e-2                  0.1: 1e-1                    1: 1                      10: 10                    100: 100                  1000: 1000                10000: 1e4                100000: 1e5       Domain  0.015      0.0000314: 0               0.0003142: 0               0.0031416: 0.003           0.0314159: 0.031           0.3141593: 0.314           3.1415927: 3.142          31.4159265: 31.416         314.1592654: 314.159        3141.5926536: 3141.593       31415.9265359: 31415.927      314159.2653590: 314159.265          1e-05: 0                  0.0001: 0                   0.001: 0.001                0.01: 0.01                  0.1: 0.1                     1: 1                      10: 10                    100: 100                  1000: 1000                10000: 10000              100000: 100000    Domain  0.5      0.0000314: 0               0.0003142: 0               0.0031416: 0.003           0.0314159: 0.031           0.3141593: 0.314           3.1415927: 3.142          31.4159265: 31.416         314.1592654: 314.159        3141.5926536: 3141.593       31415.9265359: 31415.927      314159.2653590: 314159.265          1e-05: 0                  0.0001: 0                   0.001: 0.001                0.01: 0.01                  0.1: 0.1                     1: 1                      10: 10                    100: 100                  1000: 1000                10000: 10000              100000: 100000    Domain  5      0.0000314: 0               0.0003142: 0               0.0031416: 0               0.0314159: 0.03            0.3141593: 0.31            3.1415927: 3.14           31.4159265: 31.42          314.1592654: 314.16         3141.5926536: 3141.59        31415.9265359: 31415.93       314159.2653590: 314159.27           1e-05: 0                  0.0001: 0                   0.001: 0                    0.01: 0.01                  0.1: 0.1                     1: 1                      10: 10                    100: 100                  1000: 1000                10000: 10000              100000: 100000    Domain  100      0.0000314: 0               0.0003142: 0               0.0031416: 0               0.0314159: 0               0.3141593: 0.3             3.1415927: 3.1            31.4159265: 31.4           314.1592654: 314.2          3141.5926536: 3141.6         31415.9265359: 31415.9        314159.2653590: 314159.3            1e-05: 0                  0.0001: 0                   0.001: 0                    0.01: 0                     0.1: 0.1                     1: 1                      10: 10                    100: 100                  1000: 1000                10000: 10000              100000: 100000    Domain  1000000.0      0.0000314: 3.1e-5          0.0003142: 3.1e-4          0.0031416: 3.1e-3          0.0314159: 3.1e-2          0.3141593: 3.1e-1          3.1415927: 3.1            31.4159265: 3.1e1          314.1592654: 3.1e2          3141.5926536: 3.1e3          31415.9265359: 3.1e4          314159.2653590: 3.1e5               1e-05: 1e-5               0.0001: 1e-4                0.001: 1e-3                 0.01: 1e-2                  0.1: 1e-1                    1: 1                      10: 10                    100: 100                  1000: 1000                10000: 1e4                100000: 1e5

These are now the results of pprint_val for all of the domains in a human-readable form.

@mdboom
Copy link
Member

👍

mdboom added a commit that referenced this pull requestDec 14, 2015
@mdboommdboom merged commitc6dda2d intomatplotlib:masterDec 14, 2015
mdboom added a commit that referenced this pull requestDec 14, 2015
@mdboom
Copy link
Member

Backported to 2.0.x as7414cf0

@tacaswelltacaswell deleted the fix_logformatterexponent branchDecember 19, 2015 02:31
tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull requestDec 19, 2015
@QuLogic
Copy link
Member

Backport to v2.x is actually via5ff7e37.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.0.0
Development

Successfully merging this pull request may close these issues.

3 participants
@tacaswell@mdboom@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp