Skip to content

Fix bar3d bug with matching color string and array x lengths #15826

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 2 commits into from
Jun 9, 2020

Conversation

UmarJ
Copy link
Contributor

@UmarJ UmarJ commented Dec 3, 2019

PR Summary

Closes #15815
The bug is caused by the line len(color) == len(x), since len(color) is the length of string rather than the actual number of colors.

Converting color to an RBG array before comparison ensures that len(color) actually represents the number of colors.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@UmarJ UmarJ mentioned this pull request Dec 3, 2019
@UmarJ UmarJ changed the title Closes #15815 (bar3d color length bug) Fix bar3d bug with matching color string and array x lengths Dec 3, 2019
@UmarJ
Copy link
Contributor Author

UmarJ commented Dec 4, 2019

Why did these checks fail?

@tacaswell
Copy link
Member

The failure on the nightly job was due to a change in numpy that broke our test suite (they are now warning someplace we did not expect and we fail the test suite on warnings) which is not your problem. On the master branch we now mark the nightly job as an "allowed failure" so the next time you push a commit it it won't fail.

Lines changed in the coverage report are clearly unrelated to this PR, I suspect it is a glitch in the coverage reports.

Can you add a test for this? I don't think we need an image test. It is probably enough to test that it does not fail and assert that the color of the returned bar objects in orange.

Thank you for you work on this! 🎆

@tacaswell tacaswell added this to the v3.3.0 milestone Dec 5, 2019
@UmarJ
Copy link
Contributor Author

UmarJ commented Jan 10, 2020

Can you add a test for this? I don't think we need an image test. It is probably enough to test that it does not fail and assert that the color of the returned bar objects in orange.

I was thinking of doing that by comparing the RGBA values in the _edgecolors attribute of the returned Poly3DCollection object, but there has to be a better way. Any ideas?

@QuLogic
Copy link
Member

QuLogic commented May 4, 2020

The original issue crashes, so a test like that checks both that it has the expected result and doesn't crash. I don't think there any need to find some better kind of test.

@QuLogic QuLogic force-pushed the bugfix-for-issue-15815 branch from 8df22f0 to 7817680 Compare June 8, 2020 23:47
@QuLogic
Copy link
Member

QuLogic commented Jun 8, 2020

I pushed a simple smoke test, so that we can merge this for 3.3.

@QuLogic QuLogic force-pushed the bugfix-for-issue-15815 branch from 7817680 to 680e839 Compare June 9, 2020 06:48
@timhoffm timhoffm merged commit 5157797 into matplotlib:master Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bar3d color length bug
5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy