Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fix scatter() with empty data and c argument#12672
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Can you also use |
@@ -1741,6 +1741,11 @@ def test_scatter_color(self): | |||
with pytest.raises(ValueError): | |||
plt.scatter([1, 2, 3], [1, 2, 3], color=[1, 2, 3]) | |||
def test_scatter_empty(self): |
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 you also add a test for pandas with a non-0 based index?
There is also#12673 with the same aim to fix this. |
I'm going to close this@TimHoffman, in favour of#12673, because the proposer for that PR put a lot of effort into getting consensus before opening their PR. Hope that's OK.... |
PR Summary
Fixes#12641. The issue is that
c[0]
is accessed for an empty array (the 3d code drops invalid points and thus passes an empty array in case of the MWE#12641 (comment)).Note: While the canonical way of checking emptiness is
if c
, I feel it's more clear to uselen(c) > 0
here.PR Checklist