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
Transparency, color mixing, gamma & linear color space ? #5949
This is my first time playing with matplotlib so I'm not sure if this is a feature or a bug but I needed to scatter a large number of points that are transparent. I need transparency so that I could observe the density of theses particles (I should probably make a 2D histogram... ). The problem I noticed is that if I increased the alpha of particles I would start to see black. The picture explains it.
I believe the problem is the handling of colors internally. Is it all linear color space with correct gamma handling ?
There is work going on to improve image interpolation. I think that covers
some blending. We should probably make sure of that.
As for your situation, though, use hexbin(). It is designed for these sorts
of plots.
On Jan 30, 2016 7:37 PM, "Goran" notifications@github.com wrote:
Hello all.
This is my first time playing with matplotlib so I'm not sure if this is a
feature or a bug but I needed to scatter a large number of points that are
transparent. I need transparency so that I could observe the density of
theses particles (I should probably make a 2D histogram... ). The problem I
noticed is that if I increased the alpha of particles I would start to see
black. The picture explains it.
Currently we do blending in uint8 RGBA buffers, to support this we would need to move to doing the blending in float buffers. This will involved a good deal of c++ work in the AGG layer and possibly work with the upstream Agg project.
@mdboom Has reported (more or less) that the Agg folks claim this should work, but when he tried it (recently) it did not work as advertised. I am not sure where the branch he was working on is though.
I'd defer to @mdboom because #5718 is a pretty big PR and I don't quite follow all of it, but the example you gave in the first post works on v2.x all the way back until the backport of #5718, before which it exhibits the old behaviour.
Yep, sorry for the noise. My tabs got crossed somehow and I meant to ask @gvinterhalter for a small example, but in the meantime I've written one myself:
importnumpyasnpmatplotlib.pyplotaspltnp.random.seed(1)
x=np.random.randn(100000)
y=np.random.randn(100000)
plt.plot(x, y, 'o', markerfacecolor='m', markeredgecolor='none', alpha=0.005)
plt.show()
It works if you use mplcairo.set_option(float_surface=True) (which is basically exactly what this PR asks for)... but you need to be using cairo master for that :-)
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!
Activity
WeatherGod commentedon Jan 31, 2016
There is work going on to improve image interpolation. I think that covers
some blending. We should probably make sure of that.
As for your situation, though, use hexbin(). It is designed for these sorts
of plots.
On Jan 30, 2016 7:37 PM, "Goran" notifications@github.com wrote:
tacaswell commentedon Feb 15, 2016
Currently we do blending in uint8 RGBA buffers, to support this we would need to move to doing the blending in float buffers. This will involved a good deal of c++ work in the AGG layer and possibly work with the upstream Agg project.
gvinterhalter commentedon Feb 15, 2016
Maybe this can help
https://sourceforge.net/p/vector-agg/mailman/vector-agg-general/thread/D15DE8FE767142738F1879DE856244F5@gmail.com/
tacaswell commentedon Feb 15, 2016
@mdboom Has reported (more or less) that the Agg folks claim this should work, but when he tried it (recently) it did not work as advertised. I am not sure where the branch he was working on is though.
QuLogic commentedon Sep 29, 2016
This was fixed by #5718.
tacaswell commentedon Sep 30, 2016
@QuLogic I do not understand how this was fixed.
QuLogic commentedon Sep 30, 2016
I'd defer to @mdboom because #5718 is a pretty big PR and I don't quite follow all of it, but the example you gave in the first post works on
v2.xall the way back until the backport of #5718, before which it exhibits the old behaviour.QuLogic commentedon Sep 30, 2016
Err, wait, this might be the wrong issue actually? Let me double-check.
QuLogic commentedon Sep 30, 2016
Yep, sorry for the noise. My tabs got crossed somehow and I meant to ask @gvinterhalter for a small example, but in the meantime I've written one myself:
which is naturally still broken on

v2.x:sjvrijn commentedon Sep 26, 2020
Can confirm that the above example still produces the same output in version 3.3.2
jklymak commentedon Sep 26, 2020
Does this work in mpl-cairo?
jklymak commentedon Sep 26, 2020
... no, it actually is more pronounced I think...
anntzer commentedon Sep 26, 2020
It works if you use
mplcairo.set_option(float_surface=True)(which is basically exactly what this PR asks for)... but you need to be using cairo master for that :-)github-actions commentedon Oct 9, 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!