Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed

Conversation

timhoffm
Copy link
Member

PR Summary

Fixes#12641. The issue is thatc[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 isif c, I feel it's more clear to uselen(c) > 0 here.

PR Checklist

  • Has Pytest style unit tests

@tacaswelltacaswell added this to thev3.0.x milestoneOct 29, 2018
@tacaswell
Copy link
Member

if c will fail on numpy arrays with "Truth value of an array is ambigious, use .any or .all" ;)

Can you also usesafe_first_element instead ofc[0]?

@@ -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):
Copy link
Member

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?

@ImportanceOfBeingErnest
Copy link
Member

There is also#12673 with the same aim to fix this.

@jklymak
Copy link
Member

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....

timhoffm reacted with thumbs up emoji

@timhoffmtimhoffm deleted the fix-scatter-empty-color branchOctober 31, 2018 07:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.0.2
Development

Successfully merging this pull request may close these issues.

4 participants
@timhoffm@tacaswell@ImportanceOfBeingErnest@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp