fix for pcolormesh doesn't allow shading = 'flat' in the option#25058
fix for pcolormesh doesn't allow shading = 'flat' in the option#25058jklymak merged 4 commits intomatplotlib:mainfrom
Conversation
There was a problem hiding this comment.
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.
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.
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.
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.
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 |
dstansby
left a comment
There was a problem hiding this comment.
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
pytestpasses)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.rstornext_api_changes/README.rst