-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix some scatter plot issues #7167
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
Unrelated to this PR but I noticed that typing of _Normalze was quite difficult because _unique_inverse can be a np.ndarray or DataArray, maybe you could clear that up a bit? |
I've reworked _Normalize a little now. Hopefully a little easier to follow. Still not a fan of the optional None outputs, it adds too much extra code. Oh well, will save that for another rainy day. |
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.
You are right, the optional return make stuff a bit complicated. Not sure how to solve this though?
Maybe an extra class for the case of data=None
?
Or it could be solved with a Generic class?
But I agree that this can be solved in another PR.
Thanks for addressing this!
def _indexes_centered(self, x: DataArray) -> DataArray: | ||
... | ||
|
||
def _indexes_centered(self, x: np.ndarray | DataArray) -> np.ndarray | DataArray: |
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.
Not sure why you didn't like the TypeVar here? But ok, the results are the same.
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 mypy started complaining when I added typing to .values
, so I tried Union and finally overloads. This was one of the earliest changes though so maybe it works now when I changed ._unique_inverse ?
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.
Maybe one of these instances where you need to use a TypeVar bound to a Union instead?
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.
Maybe, I'll tests this a bit more later once I find a new bug. This works good enough for now.
* main: Add import ASV benchmark (pydata#7176) Rework docs about scatter plots (pydata#7169) Fix some scatter plot issues (pydata#7167) Fix doctest warnings, enable errors in CI (pydata#7166) fix broken test (pydata#7168) Add typing to plot methods (pydata#7052) Fix warning in doctest (pydata#7165) dev whats-new (pydata#7161) v2022.10.0 whats-new (pydata#7160)
* main: Add import ASV benchmark (pydata#7176) Rework docs about scatter plots (pydata#7169) Fix some scatter plot issues (pydata#7167) Fix doctest warnings, enable errors in CI (pydata#7166) fix broken test (pydata#7168) Add typing to plot methods (pydata#7052) Fix warning in doctest (pydata#7165)
Fix some issues with scatter plots:
.values_unique
not returning the same values as.values
xref: #6778