-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The scale passed to the `pprint_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 via http://stackoverflow.com/questions/33975758/matplotlib-logformatterexponent-e-in-the-exponent-labels-of-cbar
Sigh, meant to target this against v2.0.x, oh well. |
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 testing import itertools import matplotlib.ticker as mticker import numpy as np domains = 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)]))
These are now the results of pprint_val for all of the domains in a human-readable form. |
👍 |
mdboom
added a commit
that referenced
this pull request
Dec 14, 2015
FIX: formatting in LogFormatterExponent
mdboom
added a commit
that referenced
this pull request
Dec 14, 2015
FIX: formatting in LogFormatterExponent
Backported to 2.0.x as 7414cf0 |
tacaswell
pushed a commit
to tacaswell/matplotlib
that referenced
this pull request
Dec 19, 2015
…onent FIX: formatting in LogFormatterExponent
Backport to v2.x is actually via 5ff7e37. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The scale passed to the
pprint_val
method needs to also bescaled 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 via http://stackoverflow.com/questions/33975758/matplotlib-logformatterexponent-e-in-the-exponent-labels-of-cbar
More coming on
pprint_val