You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overlaying imshow with transparancy / alpha yields different results in pdf and png when using savefig #18871
Output files:
Colors in output files seem consistent between different OS and viewers.
# Mybinder version info:
3.3.2 module://ipykernel.pylab.backend_inline
# Local version info:
3.3.2 TkAgg
Expected outcome
Produced colors being consistent between different output formats, i.e. a equal color for each of the respective squares between the PNG and PDF output. OR a clear warning in the documentation (I am not aware of such a warning existing, but I might have missed it).
Yes, they do seem related! Using the code from #8847 and save as pdf and png yields the same images as shown there:
So, comparing, it seems the .png agrees with the software compositing, and the .pdf agrees with the agg style compositing
For those stumbling upon this problem: I found a workaround, as the .pdf get's the same behaviour as the .png when adding interpolation='none' to at least one of the initial imshow calls, like such:
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
wow, thanks @TAdeJong for the workaround!
The issue still persists, but it seems like the referenced #8847 just recently received a fix PR #32107.
Lets see what effect this will have on this issue, and also on #25806!
Activity
anntzer commentedon Nov 2, 2020
Possibly related to #8847?
TAdeJong commentedon Nov 2, 2020
Yes, they do seem related! Using the code from #8847 and save as pdf and png yields the same images as shown there:

So, comparing, it seems the .png agrees with the software compositing, and the .pdf agrees with the agg style compositing
TAdeJong commentedon Nov 2, 2020
For those stumbling upon this problem: I found a workaround, as the .pdf get's the same behaviour as the .png when adding
interpolation='none'to at least one of the initial imshow calls, like such:github-actions commentedon Sep 4, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
codeceptsDE commentedon Aug 17, 2026
wow, thanks @TAdeJong for the workaround!
The issue still persists, but it seems like the referenced #8847 just recently received a fix PR #32107.
Lets see what effect this will have on this issue, and also on #25806!
ayshih commentedon Aug 18, 2026
I've confirmed that this issue has also been fixed by #32107