-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add alpha-array support to _rgb_to_rgba #26520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alpha-array support to _rgb_to_rgba #26520
Conversation
melissawm
commented
Aug 18, 2023
Hi @AALAM98mod100 - just leaving a note that if you want this to be reviewed make sure you mark it as "Ready for review". Cheers!
oscargus
commented
Aug 31, 2023
Thanks for the PR! As far as I can tell, it looks good!
However, I am a bit surprised to see that it doesn't work for SVGs? Especially since there is an embedded PNG in the SVG. This may be a another issue though... But do you have any comments on that? Maybe we should wait with adding SVG and PDF test images (although they are quite small, so not sure if it really is a problem).
Right now we are in the final stages of releasing 3.8, so it may take some time to get additional feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be better written as a check_figures_equal test. Compare a (n, m, 3) array plus additional alpha to the same plot with a (n, m, 4) array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also concerning that the png and svg images are different....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what input is np.ndim(alpha) == 0 addressing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scalar alpha input should remaing unaffected by new code. This ensures just that
stevezhang1999
commented
Sep 5, 2023
Just as a FYI, in the original issue thread, some incorrect result was observed using savefig (I haven't tested it yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modifies A in place where as in the other branches we get a copy of A back. Because it modifies in in place and we cache A higher up in the call stack it will apply the alpha everytime it draws.
@tacaswell
tacaswell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests should use check_figures_equal and the multiple application of alpha needs to be fixed.
rcomer
commented
Nov 16, 2025
Thank you for your work on this @AALAM98mod100. The RGB case has now been fixed by #28437, which also made a refactor causing the conflicts we now see here. Given those conflicts and the fact that this PR was anyway stalled for some time, I think it's sensible to close this one in favour of #30523, which addresses the RGBA case.
Uh oh!
There was an error while loading. Please reload this page.
PR summary
PR checklist
Plotting demo:
Code