-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deduplicate implementations of FooNorm.autoscale{,_None} #12309
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
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.
Good, except for some style issues.
A = np.ma.masked_less_equal(A, 0, copy=False) | ||
self.vmin = np.ma.min(A) | ||
self.vmax = np.ma.max(A) | ||
super().autoscale(np.ma.masked_less_equal(A, 0, copy=False)) |
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.
# docstring inherited
😄
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 thought about it, then decided against because here all methods are in the same file and the overrides are quite short (one or two lines), so I thought things were clear enough as they are. If you really want it let me know (or push it yourself, either way).
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 would still do it. It's a statement of intent. Without that, someone will be tempted in the future to add a docstring.
Also, let's just make it a general general rule. Every public method should have either a docstring or a # docstring inherited
comment. If we then encounter a method without that, it's immediately clear that nobody has thought about the documentation so far.
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.
done (x4)
self.vmin = A.min() | ||
if self.vmax is None and A.size: | ||
self.vmax = A.max() | ||
super().autoscale_None(np.ma.masked_less_equal(A, 0, copy=False)) |
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.
# docstring inherited
lib/matplotlib/colors.py
Outdated
Dummy replacement for Normalize, for the case where we | ||
want to use indices directly in a | ||
:class:`~matplotlib.cm.ScalarMappable` . | ||
Dummy replacement for Normalize, for the case where we want to use indices |
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.
would be nice to link `Normalize`
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.
done
""" | ||
self.vmin = np.ma.min(A) | ||
self.vmax = np.ma.max(A) | ||
super().autoscale(A) |
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.
# docstring inherited
self.vmin = A.min() | ||
if self.vmax is None and A.size: | ||
self.vmax = A.max() | ||
super().autoscale_None(A) |
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.
# docstring inherited
c002bd6
to
888a888
Compare
... and some docstring cleanups.
888a888
to
a686376
Compare
... and some docstring cleanups.
PR Summary
PR Checklist