Fixes Agg/Cairo antialiased rendering of contourf/pcolor/pcolormesh by using a blend group - #32256
Fixes Agg/Cairo antialiased rendering of contourf/pcolor/pcolormesh by using a blend group#32256ayshih wants to merge 7 commits into
Conversation
7741f0b to
3c1da25
Compare
|
Can you explain what exactly is happening and why it's fixed via a plus blend mode? I think that may have gotten buried in the other PR. My first reaction was "this makes basic sense, but I need to look up the formula for Plus again." |
iccir
left a comment
There was a problem hiding this comment.
Maybe add a comment about why "plus" was chosen, but there are also existing comments in the source base about this + intermediate buffers.
|
The matplotlib/lib/matplotlib/axes/_axes.py Lines 6697 to 6699 in 17552e2 Those artificial lines are now gone, so this explanation no longer makes sense. Should we change the default? The default for |
I'm +1 on "default to the more-correct-looking option", unless there are other concerns. |
It's because the alpha at the edge of an antialiased patch represents how much the edge fills the pixel. When two patches are exactly adjacent and should fill the pixel entirely to a resulting
I've added (fairly wordy) comments in the code, which should help future maintainers.
No. I believe these are the only collections where the patches are expressly constructed to be abutting with no overlaps. A collection in general could have overlapping patches, and the "plus" blend mode would give a bad result.
I've changed all three so they no longer forcefully disable antialiasing by default, and now the default is simply |
f796bc6 to
0f876cf
Compare
Is there a way that downstream libraries could take advantage of this functionality for their own collections? For example, Cartopy has a collection that enables drawing choropleth maps. |
b34d542 to
5d84818
Compare
1f7e0d7 to
d4e1f1c
Compare
714776f to
ce3f7d7
Compare
4b5f5ca to
32b1c1c
Compare

PR summary
This PR fixes Agg/Cairo antialiased rendering of contourf/pcolor/pcolormesh by using a blend group (see #31162, where these fixes were separated out of). In the examples below, look at the right-most panel and see how the faint lines between antialiased patches are fixed by this PR. The middle panel shows why it is desirable to turn on antialiasing when alpha < 1.
Since these fixes require #31162, this PR cannot be backported to 3.11.x.
contourf
Before this PR
After this PR
pcolor/pcolormesh
Before this PR
After this PR
AI Disclosure
No AI was used
PR quality check