Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Transparency, color mixing, gamma & linear color space ? #5949

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

Open
gvinterhalter opened this issue Jan 31, 2016 · 14 comments
Open

Transparency, color mixing, gamma & linear color space ? #5949

gvinterhalter opened this issue Jan 31, 2016 · 14 comments
Labels
backend: agg keep Items to be ignored by the “Stale” Github Action topic: color/alpha

Comments

@gvinterhalter
Copy link

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.

problem

I believe the problem is the handling of colors internally. Is it all linear color space with correct gamma handling ?

@WeatherGod
Copy link
Member

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" [email protected] 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.

[image: problem]
https://cloud.githubusercontent.com/assets/6205969/12699436/2f481e32-c7bb-11e5-9003-d23229f51d59.png

I believe the problem is the handling of colors internally. Is it all
linear color space with correct gamma handling ?


Reply to this email directly or view it on GitHub
#5949.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Feb 15, 2016
@tacaswell
Copy link
Member

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.

@tacaswell tacaswell modified the milestones: unassigned, 2.1 (next point release) Feb 15, 2016
@gvinterhalter
Copy link
Author

@tacaswell
Copy link
Member

@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
Copy link
Member

QuLogic commented Sep 29, 2016

This was fixed by #5718.

@QuLogic QuLogic closed this as completed Sep 29, 2016
@QuLogic QuLogic modified the milestones: 2.0 (style change major release), unassigned Sep 29, 2016
@tacaswell
Copy link
Member

@QuLogic I do not understand how this was fixed.

@QuLogic
Copy link
Member

QuLogic commented 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.x all the way back until the backport of #5718, before which it exhibits the old behaviour.

@QuLogic
Copy link
Member

QuLogic commented Sep 30, 2016

Err, wait, this might be the wrong issue actually? Let me double-check.

@QuLogic
Copy link
Member

QuLogic commented 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:

import numpy as np
matplotlib.pyplot as plt

np.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()

which is naturally still broken on v2.x:
figure_1

@QuLogic QuLogic reopened this Sep 30, 2016
@QuLogic QuLogic modified the milestones: unassigned, 2.0 (style change major release) Sep 30, 2016
@sjvrijn
Copy link
Contributor

sjvrijn commented Sep 26, 2020

Can confirm that the above example still produces the same output in version 3.3.2

@jklymak
Copy link
Member

jklymak commented Sep 26, 2020

Does this work in mpl-cairo?

@jklymak
Copy link
Member

jklymak commented Sep 26, 2020

... no, it actually is more pronounced I think...

@anntzer
Copy link
Contributor

anntzer commented 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 :-)

@story645 story645 modified the milestones: unassigned, needs sorting Oct 6, 2022
@github-actions
Copy link

github-actions bot commented 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!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Oct 9, 2023
@anntzer anntzer removed the status: inactive Marked by the “Stale” Github Action label Oct 9, 2023
@anntzer anntzer added keep Items to be ignored by the “Stale” Github Action backend: agg labels Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: agg keep Items to be ignored by the “Stale” Github Action topic: color/alpha
Projects
None yet
Development

No branches or pull requests

8 participants