-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
BUG: fix minpos handling and other log ticker problems #7598
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
Conversation
The log scales test is easy to fix; I need a little more time with the logit scales test. |
# It's probably a colorbar with | ||
# a format kwarg setting a LogFormatter in the manner | ||
# that worked with 1.5.x, but that doesn't work now. | ||
self._sublabels = set((1,)) # label powers of base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Python 2.7, can use a set literal {1}
.
|
||
result = mtransforms.nonsingular(vmin, vmax) | ||
return result | ||
def nonsingular(self, vmin, vmax): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we already have have a nonsingular?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but 'nonsingular' means different things for different transforms--different behaviors are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this have a leading underscore? I missread and did not notice that this was a method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could, but there are other nonsingular
methods like this that don't, and they are called as locator.nonsingular(x0, x1)
in autoscale_view(). So if I were to add an underscore here, I would either have to use two different calls in autoscale_view, or add an underscore to the other locator methods with that name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sold on consistency of naming.
6f53d3d
to
7275129
Compare
Reviewers: the factoring and re-arranging I did will make it harder to evaluate the changes via the diffs, but easier to see what is going on in the LogFormatters, and how they differ, if you look at the ticker.py file itself. |
Good catch. That was a silly bug. I will push a fix in a few minutes. |
7275129
to
7fb5c4c
Compare
if vmax >= 1: | ||
vmax = 1 - minpos | ||
if vmin == vmax: | ||
return 0.1 * vmin, 10 * vmin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not stay vmin < 1
for all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Fix is coming.
👍 this looks like it greatly simplifies (or at least reduces code duplication in) this part of the code base! |
7fb5c4c
to
9ca7b19
Compare
This does appear to be working on all the examples I could try. @efiring I'm not sure you meant to amend that last commit as it doesn't appear related to the new changes. |
Closes matplotlib#7595, matplotlib#7493, matplotlib#7587. Bbox._minpos is now initialized to [np.inf, np.inf] instead of [1e-7, 1e-7]. Old code with a colorbar in which the formatter is set to a LogFormatter and a SymlogNorm is used now works again (although the results are better in 2.0 if the colorbar is left to handle the formatter automatically). LogLocator now has its own nonsingular() method which provides a reasonable starting point for a log axis when no data have been plotted.
@QuLogic you are correct, I made a mistake. When running |
9ca7b19
to
aa36ec3
Compare
Closes #7595, #7493, #7587.
Bbox._minpos is now initialized to [np.inf, np.inf] instead of
[1e-7, 1e-7].
Old code with a colorbar in which the formatter is set to
a LogFormatter and a SymlogNorm is used now works again (although
the results are better in 2.0 if the colorbar is left to handle
the formatter automatically).
LogLocator now has its own nonsingular() method which provides
a reasonable starting point for a log axis when no data have
been plotted.