Pcolormesh with Gouraud shading: masked arrays#26072
Pcolormesh with Gouraud shading: masked arrays#26072tacaswell merged 2 commits intomatplotlib:mainfrom
Conversation
|
Test failure does appear to be related:
|
|
@ksunden Right you are! This turned up a bug in the ps backend, the fix for which was to copy over 2 lines from the pdf backend. The original test image was also displaying incorrect masking behavior for the gouraud case; in that test there are no unmasked triangles, so the correct plot is a blank Axes. With a tiny grid, 3 by 6, the masking ends up having a very different effect in the gouraud case than in the normal pcolormesh case. The problem is that the test is no longer testing any normal case with the ps backend. I will have to fix that, either with a new test or by modifying an existing test. |
greglucas
left a comment
There was a problem hiding this comment.
I personally think this is an improvement, but I do wonder if other people prefer the alpha=0 gouraud shading in some situations and would want a way to get that? It doesn't seem like the old code is even correct for the alpha-blending, but I could see someone wanting the alpha to be smoothly blended towards the zero-corner rather than dropped completely. Maybe we just wait until that request comes in though...
Closes matplotlib#8802. Fixes bug in backend_ps with zero-triangle gouraud inputs. Adds a test for this, and for valid gouraud cases with masking.
e6c25b7 to
b741db8
Compare
|
Logically, the best way to handle masking would be to carry the mask information along and use it directly, rather than using alpha=0 as a proxy for a masked point. That would permit the new behavior here--a masked vertex poisons all its triangles--and also allow full RGBA blending, including with alpha=0, on backends that support it. I will try it. |
|
The two failures are unrelated to the PR. |
Closes #8802.
PR summary
This PR modifies QuadMesh such that with Gouraud shading, masked "color" array data
for any vertex prevents triangles using that vertex from being rendered. This is similar to what
pcolordoes. It differs from thepcolormeshnon-Gouraud shadings, for which all regionsare rendered, but masked regions are transparent. This PR changes only the Gouraud shading.
A bug in the Gouraud shading for the PS backend is fixed.
Tests are modified to cover that bug fix, to include masked arrays, and to demonstrate Gouraud
shading with the PS backend.
PR checklist