-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix for pcolormesh doesn't allow shading = 'flat' in the option #25058
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
Conversation
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.
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.
937f4c9
to
0732c7d
Compare
fdf570b
to
8ed4c02
Compare
Hi @vivekvedant - thanks for the PR! It looks like you have a couple of linting errors (you can see them here https://github.com/matplotlib/matplotlib/actions/runs/3980860096/jobs/6824208412 or clicking on "Details" on the Linting/flake8 job.) This does not block a review of your PR but if you have the time it would be nice to fix them 😄 Otherwise, now we wait for a maintainer to review your code. Thanks! |
9ec152d
to
98dd012
Compare
lib/matplotlib/axes/_axes.py
Outdated
' X (%d) and/or Y (%d); see help(%s)' % ( | ||
C.shape, Nx, Ny, funcname)) | ||
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should" | ||
f"be one larger than C{C.shape}" |
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.
This error should probably say something about shading='flat', because it is possible to pass x and y the same shape as C for shading='auto' and shading='nearest'. See https://matplotlib.org/stable/gallery/images_contours_and_fields/pcolormesh_grids.html for a discussion.
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.
@jklymak Sir, Updated the error message
lib/matplotlib/axes/_axes.py
Outdated
raise TypeError('Dimensions of C %s are incompatible with' | ||
' X (%d) and/or Y (%d); see help(%s)' % ( | ||
C.shape, Nx, Ny, funcname)) | ||
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should" |
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.
Y should be capitalized. Suggest "Relevant" because X and Y can be 2-D.... Otherwise this looks good to me...
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should" | |
raise TypeError(f"Relevant dimensions of X({Nx}) and Y({Ny}) should" |
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.
Ok Sir, Thank you for the suggestion
lib/matplotlib/tests/test_axes.py::test_pcolorflaterror Test failure is a consequence of this change, specifically that the older error message pattern is being matched in the test. |
Ok @ksunden Sir, Thanks for the insights I will recommit the changes to solve this issue |
6d8e671
to
04f0dc1
Compare
@jklymak Sir, I have updated the error message and also fix the issue related to Test failure |
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.
Thanks a lot for the PR - looks great to me! 👍
Thanks @vivekvedant and congratulations on your first Matplotlib PR. We hope to see you again... |
…g = 'flat' in the option
…058-on-v3.7.x Backport PR #25058 on branch v3.7.x (fix for pcolormesh doesn't allow shading = 'flat' in the option)
Fix for pcolormesh doesn't allow shading = 'flat' in the option #24678
PR Summary
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst