ENH: Add centered-gouraud shading to pcolormesh#31362
ENH: Add centered-gouraud shading to pcolormesh#31362lucaznch wants to merge 1 commit intomatplotlib:mainfrom
Conversation
|
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. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. 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. |
Implement a variant of Gouraud shading that supports grids with dimensions one greater than the data in each dimension. Add tests and documentation. Update type hints and rcParams validation. Include a What's New entry. Fixes matplotlib#8422
7b76875 to
15d8932
Compare
|
I realized I forgot to run boilerplate.py to update pyplot.py, which is why some tests were failing. Ive just amended the commit and pushed the updated branch! |
PR summary
This PR adds the
centered-gouraudshading toAxes.pcolormesh. It is a variant ofgouraudthat adds support for grids that are one larger than the data in each dimension. In this situation,centered-gouraudautomatically converts it to match the data by taking the centers of each quadrilateral, averaging its four corners, and then applies Gouraud shading.Why is this change necessary / what problem does it solve?
pcolormeshwithshading='gouraud'requires the grid to match the shape of the data. If the user is working with a grid one larger in each dimension and tries to usegouraud, a TypeError is raised.centered-gouraudsolves this by allowing such grids without requiring users to reshape them.What is the reasoning for this implementation?
Rather than modifying the existing
gouraudshading, a new shading was added following a discussion with @timhoffm on the issue this PR addresses.Example:
Closes #8422
AI Disclosure
I used AI tools to help proofread and improve the grammar of this PR description. The code logic and implementation are my own.
PR checklist