fixed gouraud error in pcolormesh #26320
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 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.
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.
|
I don't think we should change data without at least warning. If users want to avoid a warning they can pass centred coords. |
| X = (X[1:, 1:] + X[:1, :-1]) / 2 | ||
| Y = (Y[1:, :-1] + Y[:-1, :-1]) / 2 |
There was a problem hiding this comment.
I haven't looked at these shapes in detail, but shouldn't these be consistent?
| X = (X[1:, 1:] + X[:1, :-1]) / 2 | |
| Y = (Y[1:, :-1] + Y[:-1, :-1]) / 2 | |
| X = (X[1:, 1:] + X[:-1, :-1]) / 2 | |
| Y = (Y[1:, 1:] + Y[:-1, :-1]) / 2 |
There was a problem hiding this comment.
Might work, but I thought is made more since to change the X and Y boundary points independently.
We do not change the user copy of the data. I don't think that the X/Y boundary arguments make since in regard to the gouraud shading, so this is the most obvious behavior. |
|
Right, but users often don't know this about Gouraud shading and they should before they try to interpret their data. Before we errored - I'm fine with a warning, but I don't think we should just silently regrid. |
Perhaps we should just include a note in the doc-string. I think a warning would be an annoyance here and maybe a bit of an overkill. |
|
We just got pcolormesh to stop dropping rows and columns silently. I'm 👎 on more silent behaviour. But others can chime in if they want. |
PR summary
closes #8422
fixed unlikely exception when pcolormesh is called with cell boundaries instead of cell centers by
checking for this specific condition pcolormesh code.
If boundaries are passed, average them to compute the center points and continue on.
PR checklist