Skip to content

FIX symlog scale now shows negative labels. #7337

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 3 commits into from
Oct 29, 2016
Merged

FIX symlog scale now shows negative labels. #7337

merged 3 commits into from
Oct 29, 2016

Conversation

NelleV
Copy link
Member

@NelleV NelleV commented Oct 24, 2016

The formatter returned empty strings for negative value.

closes #7146

@NelleV
Copy link
Member Author

NelleV commented Oct 24, 2016

For information, I am uncovering major problems in the ticker module.

The formatter returned empty strings for negative value.

closes #7146
@NelleV NelleV changed the title [WIP] FIX symlog scale now shows negative labels. [MRG] FIX symlog scale now shows negative labels. Oct 24, 2016
@NelleV NelleV added this to the 2.0 (style change major release) milestone Oct 24, 2016
@NelleV NelleV added status: needs review Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels Oct 24, 2016
elif x > 10000:
s = '%1.0e' % x
s = '%1.0e' % abs(x)
Copy link
Member

Choose a reason for hiding this comment

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

Something is still wrong--this doesn't make sense. It looks like the solution is to remove all of these abs calls, and instead set x = abs(x) right after saving the sign of x, a few lines above.

Copy link
Member

Choose a reason for hiding this comment

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

Also, if the LogFormatter is going to handle negative values, this should be explained in the docstring.

Copy link
Member Author

Choose a reason for hiding this comment

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

The LogFormatter is used with the SymmetricalLogLocator so it should (and probably always has) deal with negative value. But the LogLocator doesn't deal with negative values.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll fix the abs stuff. Another solution is not to deal with the sign as it is done in the other formatter (or remove the explicit dealing with sign as it is done right now, I am not sure why)
Honestly, I think this whole part should be refactored and rewritten. I just wanted a quick and easy fix in this PR, as this is a critical bug for 2.0 and don't think we should refactor all this before the release.

Copy link
Member

Choose a reason for hiding this comment

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

I think that dealing with the sign separately is a simplification; all the logic can work with conditions based on x>0, as appropriate for logs. The generalization to make it usable for symlog is then just a matter of stripping off the sign at the start and putting it back at the end.

@tacaswell tacaswell changed the title [MRG] FIX symlog scale now shows negative labels. [MRG+1] FIX symlog scale now shows negative labels. Oct 26, 2016
@tacaswell
Copy link
Member

@efiring Can you re-review?

@NelleV
Copy link
Member Author

NelleV commented Oct 29, 2016

Note: the patch for #7202 relies on this fix.

@efiring efiring changed the title [MRG+1] FIX symlog scale now shows negative labels. FIX symlog scale now shows negative labels. Oct 29, 2016
@efiring efiring merged commit 1f38ea6 into matplotlib:master Oct 29, 2016
efiring added a commit that referenced this pull request Oct 29, 2016
FIX symlog scale now shows negative labels.
Conflicts:
	lib/matplotlib/tests/test_ticker.py
@efiring
Copy link
Member

efiring commented Oct 29, 2016

Back ported to v2.x as e2de966.

@NelleV
Copy link
Member Author

NelleV commented Oct 30, 2016

Thanks @efiring for merging!

@NelleV NelleV deleted the 7211_symlog branch October 30, 2016 17:09
bcongdon pushed a commit to bcongdon/matplotlib that referenced this pull request Nov 8, 2016
FIX symlog scale now shows negative labels.
Conflicts:
	lib/matplotlib/tests/test_ticker.py
bcongdon pushed a commit to bcongdon/matplotlib that referenced this pull request Nov 8, 2016
FIX symlog scale now shows negative labels.
Conflicts:
	lib/matplotlib/tests/test_ticker.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

symlog scale no longer shows labels on the negative side
4 participants