Skip to content

warning when scatter plot color settings discarded #23516

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 5 commits into from
Aug 8, 2022
Merged

warning when scatter plot color settings discarded #23516

merged 5 commits into from
Aug 8, 2022

Conversation

swaltek
Copy link
Contributor

@swaltek swaltek commented Jul 29, 2022

PR Summary

first pr, happy to add/make any necessary changes
closes #23487

The changed test in test_colorbar.py was related removing a colorbar from a scatter plot. I don't think the cmap there was necessary to test this. And running the tests on my own revealed the cmap wasn't changing the color of the scatter plot anyways

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@swaltek swaltek changed the title added warning and test scatter plot color settings discarded unless c given #23487 Jul 29, 2022
@swaltek swaltek changed the title scatter plot color settings discarded unless c given #23487 warning when scatter plot color settings discarded Jul 29, 2022
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 while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. 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.

@swaltek swaltek marked this pull request as ready for review July 29, 2022 19:19
@swaltek swaltek closed this Jul 29, 2022
@swaltek swaltek reopened this Jul 29, 2022
@swaltek
Copy link
Contributor Author

swaltek commented Jul 29, 2022

Not passing all tests I'll reopen if I figure out whats going on.

@swaltek swaltek closed this Jul 29, 2022
@tacaswell
Copy link
Member

@swaltek It is also ok to leave it open and make it a draft.

@swaltek swaltek reopened this Jul 29, 2022
@swaltek swaltek marked this pull request as draft July 29, 2022 19:35
@tacaswell
Copy link
Member

It looks like the warning found some cases in the test suite where we were passing (and ignoring) arguments! The right fix is likely to drop the cmap='spring' from those tests, but we need to verify that it was not intended to test something relevant to the problem the test is exercising.

@tacaswell tacaswell added this to the v3.6.0 milestone Jul 29, 2022
@swaltek
Copy link
Contributor Author

swaltek commented Jul 31, 2022

It looks like the warning found some cases in the test suite where we were passing (and ignoring) arguments! The right fix is likely to drop the cmap='spring' from those tests, but we need to verify that it was not intended to test something relevant to the problem the test is exercising.

The test failing in test_colorbar.py was related removing a colorbar from a scatter plot. I don't think the cmap there was necessary to test this. And running the tests on my own revealed the cmap wasn't changing the color of the scatter plot anyways

Appreciate the comments on the PR!

@swaltek swaltek marked this pull request as ready for review August 1, 2022 06:01
@swaltek swaltek marked this pull request as draft August 2, 2022 07:02
@swaltek swaltek marked this pull request as ready for review August 2, 2022 10:20
@tacaswell
Copy link
Member

Do you feel comfortable squashing this to one commit?

tacaswell
tacaswell previously approved these changes Aug 2, 2022
@tacaswell tacaswell dismissed their stale review August 3, 2022 20:50

Agree that Tim's suggestion should be taken

@tacaswell
Copy link
Member

I took back my review to take this out of the "approved review list", but for our internal counting please consider it as approved by me so only one more review is needed.

@@ -0,0 +1,3 @@
Warning when scatter plot color settings discarded
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When making an animation of a scatter plot, if you don't set *c* (the color value parameter) when initializing the artist, the color settings are ignored. `.Axes.scatter` now raises a warning if color-related settings's are changed without setting *c*
Copy link
Member

Choose a reason for hiding this comment

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

Wrap at 80 characters also.

@timhoffm
Copy link
Member

timhoffm commented Aug 5, 2022

Doc build failure is unrelated.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@timhoffm timhoffm merged commit 5d3124d into matplotlib:main Aug 8, 2022
@timhoffm
Copy link
Member

timhoffm commented Aug 8, 2022

Thanks @swaltek and congratulations on your first contribution to Matplotlib! 🎉 We hope to see you again!

MikiPWata pushed a commit to MikiPWata/matplotlib that referenced this pull request Aug 9, 2022
* Warning when scatter plot color settings discarded

* Update lib/matplotlib/axes/_axes.py

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>

* Wrapped 23516-MS.rst lines at 80 characters

* Fixed tests to look for proper warning message

* Update doc/api/next_api_changes/behavior/23516-MS.rst

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
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]: scatter plot color settings discarded unless c given
5 participants