-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Call _transform_vmin_vmax during SymLogNorm.__init__ #6780
Call _transform_vmin_vmax during SymLogNorm.__init__ #6780
Conversation
👍 Can you also add a test? It does not need to be an image test, just the minimal code that would have raised before. |
Not sure where to add that, but I'll look into it. The minimal test should be something like: Edit: I think I've found the spot. |
@@ -222,6 +223,13 @@ def test_SymLogNorm(): | |||
norm = mcolors.SymLogNorm(3, vmin=-30, vmax=5, linscale=1.2) | |||
normed_vals = norm(vals) | |||
assert_array_almost_equal(normed_vals, expected) | |||
|
|||
# Ensure that a SymLogNorm object can be used in a colorbar |
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 should be it's own test (any function name that starts with test_
will work).
It also needs the @cleanup
decorator.
❤️ pep8/pycodestyle There is some trailing white space:
This may seem petty and annoying, but keeping a consistent style (including no trailing white space) really does help on big projects with many contributors. |
Whoops. The perils of not using a proper development environment. |
👍 LGTM |
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.
Apart from the minor suggestion to delete a line from the test, this looks good--it makes sense.
norm = mcolors.SymLogNorm(0.1, vmin=-1, vmax=1, linscale=1) | ||
fig = plt.figure() | ||
cbar = mcolorbar.ColorbarBase(fig.add_subplot(111), norm=norm) | ||
plt.close(fig) |
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 this close
is unnecessary; the @cleanup
decorator handles it, doesn't it?
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 does, but this does not hurt
Changed my mind about targeting 2.x . If someone disagrees, I will not protest to it being backported. |
It's not critical, but I am mildly in favor of the backport. The change has no effect in most uses, but blocks a potential failure mode. |
@efiring Are you going to backport? |
Sure, I can do that in a few minutes. |
ENH: Call _transform_vmin_vmax during SymLogNorm.__init__
Backported to v2.x as 0ab4599 |
A fix for #6750