Fix array alpha to multiply (not replace) existing RGBA alpha#30795
Fix array alpha to multiply (not replace) existing RGBA alpha#30795timhoffm merged 1 commit intomatplotlib:mainfrom
Conversation
rcomer
left a comment
There was a problem hiding this comment.
Thanks @FazeelUsmani - the code change looks right to me. I just have a comment on the changenote.
| if the image data was a RGB or RBGA image or if :rc:`interpolation_state` | ||
| resolved to "rbga". | ||
| When passing an array to ``imshow(..., alpha=...)``, the parameter was silently ignored | ||
| if the image data was a RGB or RGBA image or if :rc:`interpolation_stage` |
There was a problem hiding this comment.
This is not quite right - for RGBA the alpha parameter replaced the image alpha channel. So alpha was not ignored.
There was a problem hiding this comment.
The issue here is that @FazeelUsmani edited the API-change note for an old PR (#28437) instead of creating a new note, which is why it is misleading.
There was a problem hiding this comment.
Ah OK. So this is actually correct relative to v3.10.0. Does that mean that this is what we want for the v3.11.0 release notes and therefore this is good to go (after a rebase)? Or should v3.11.0 release notes mention that this changed already at v3.10.1 and we're changing it again?
There was a problem hiding this comment.
Or should the release note just describe the change relative to current (v3.10.8) behaviour? I went looking for examples and found that the v3.9.1 change also appears in the v3.10.0 notes, but the v3.9.2 change does not.
So we do not have an obvious pattern for whether changes from micro releases get mentioned in the next meso release notes. I think probably the least confusing for the user would be to spell out that this has changed twice. I will push something to that effect tomorrow unless someone says otherwise or beats me to it.
|
@FazeelUsmani |
4653910 to
cf9037e
Compare
|
Azure failures are the usual subprocess timeouts. |
rcomer
left a comment
There was a problem hiding this comment.
My approval is only for the code change, since I modified the doc change.
|
I think we should have a test for this. |
|
@timhoffm there is an updated test to cover the alpha multiplication. What case still needs covering? |
|
Sorry, I mis-read. |
PR: matplotlib#30795 Issue: matplotlib#26092 Base commit: 67ebfc9 Changed lines: 24
Closes #26092
This fix makes array alpha behavior consistent with scalar alpha behavior for RGBA images. Now both scalar and array alpha values multiply with the existing alpha channel rather than replacing it.
What is the reasoning for this implementation?
This matches the existing scalar alpha behavior and provides more intuitive compositing.
Example
PR checklist