-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Small clean to SymmetricalLogLocator #14308
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
@@ -2468,22 +2468,23 @@ def tick_values(self, vmin, vmax): | |||
# "simple" mode is when the range falls entirely within (-t, | |||
# t) -- it should just display (vmin, 0, vmax) | |||
|
|||
# Determine which of the three ranges we have |
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 think the whole thing can be simplified to
if -linthresh <= vmin <= vmax <= 0 or 0 <= vmin <= vmax <= linthresh:
return [vmin, vmax]
has_a = (vmin < -linthresh)
has_b = (-linthresh < vmin < linthresh or -linthresh < vmax < linthresh)
has_c = (linthresh < 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.
I think SymLogNorm
needs quite a few more tests, which I plan to add in for 3.2
at some point; I think this is a good suggestion, but might save it for after I've written tests that exercise this logic properly.
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.
sure
if has_a: | ||
if has_b: | ||
a_range = get_log_range(t, -vmin + 1) | ||
a_range = get_log_range(linthresh, np.abs(vmin) + 1) |
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 use (builtin) abs() instead of np.abs()
Going to merge, since this has two approvals. |
b, t
withbase, linthresh
-vmin, -vmax
, usenp.abs()
, as the intent is to make sure the value passed toget_log_range()
is positive.