Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Issue 26821: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter #26834

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

Merged
merged 6 commits into from
Sep 20, 2023

Conversation

chiraagbalu
Copy link
Contributor

@chiraagbalu chiraagbalu commented Sep 19, 2023

PR summary

closes #26821

relevant issue: #26821

I made this change based off of timhoffm's comment under the issue about a potential fix. (#26821 (comment))

This PR allows for passing a numpy array to the color argument of ax.scatter when ax is initialized with projection='3d' instead of resulting in a ValueError

The changes passed the tests available for the relevant file (lib/mpl_toolkits/mplot3d/tests/test_axes3d.py), as well as that entire tests folder.

The changes also passed the code reproduction example in the joshuacnewton's bug summary (#26821 (comment))

image

PR checklist

@chiraagbalu chiraagbalu marked this pull request as ready for review September 19, 2023 23:46
@ksunden
Copy link
Member

ksunden commented Sep 19, 2023

There is an argument for including a test (probably just a smoke test), but I don't fully want to block on that.

@chiraagbalu
Copy link
Contributor Author

sorry im not sure what a smoke test means but im happy to write a test! should i just include the code reproduction example?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@ksunden
Copy link
Member

ksunden commented Sep 19, 2023

"Smoke test" here mostly just means "check that it runs and doesn't error, but don't really need to make further assertions about it". In particular, I do not think this behavior needs an image comparison test.

So more or less just wrapping what you have in a test_<name> function in test_axes3d.py, probably with a fig.canvas.draw() call in place of plt.show() to force a draw in the test setting where we don't want to "show".

@oscargus oscargus added this to the v3.8.1 milestone Sep 20, 2023
@oscargus oscargus merged commit e6af5a3 into matplotlib:main Sep 20, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 20, 2023
… truth value... when an ndarray is passed to the color kwarg of axes3d.scatter
@oscargus
Copy link
Member

oscargus commented Sep 20, 2023

Thanks @chiraagbalu and congratulations on your first merged PR in Matplotlib! Hope to see you around!

devRD pushed a commit to devRD/matplotlib that referenced this pull request Sep 20, 2023
…y is passed to the color kwarg of axes3d.scatter (matplotlib#26834)

* FIX: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter

* added smoke test to ensure no value error is thrown

* fixed smoke test to use fig canvas draw rather than plt show

* added an extra line and reduced line length to comply with flake8

* removed trailing whitespace

* Update lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Co-authored-by: Kyle Sunden <[email protected]>

---------

Co-authored-by: Kyle Sunden <[email protected]>
QuLogic added a commit that referenced this pull request Sep 20, 2023
…834-on-v3.8.x

Backport PR #26834 on branch v3.8.x (Fix Issue 26821: [Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter)
@ksunden ksunden mentioned this pull request Nov 2, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: ValueError: The truth value... when an ndarray is passed to the color kwarg of axes3d.scatter
3 participants