Skip to content
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

Internally dropping use of separate alpha value #7430

Open
anntzer opened this issue Nov 8, 2016 · 12 comments
Open

Internally dropping use of separate alpha value #7430

anntzer opened this issue Nov 8, 2016 · 12 comments
Labels
API: consistency keep Items to be ignored by the “Stale” Github Action topic: color/alpha

Comments

@anntzer
Copy link
Contributor

anntzer commented Nov 8, 2016

Having a separate alpha attribute to artists is problematic, mostly because colors can carry their own alpha values, and we then have priority issues (e.g. #7375). I think a much better approach would be to internally only store colors with alpha values, and let set_alpha and friends directly change this alpha value.

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

It may have to be handled on an artist-by-artist case. For AxesImage it is very nice to have an artist level alpha independent of the alpha in the color map.

@anntzer
Copy link
Contributor Author

anntzer commented Nov 9, 2016

Could the alpha value not simply be overwritten to (a copy of) the colormap?

@tacaswell
Copy link
Member

But you would like to persist the alpha value if you change the color map.

@anntzer
Copy link
Contributor Author

anntzer commented Nov 10, 2016

Good point.

@anntzer
Copy link
Contributor Author

anntzer commented Nov 21, 2016

Perhaps a reasonable compromise would be to maintain a separate alpha channel only for ScalarMappables (which don't really have an internal notion of own color).

@tacaswell
Copy link
Member

Probably collections as well still need to carry their own alpha (which maybe should be applied on top of any individual color alpha?) as well.

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@stippingerm
Copy link

stippingerm commented Jan 8, 2019

This is an interesting implementation question. The good user experience with graphics software tells me that instead of prioritizing one or another alpha value, one should use their combination as follows:

  • a global, collection_level_alpha value < 1 is a request for the collection being transparent to a certain level
  • in addition, individual RGBA values with A<1 indicate the some elements of the collection shall be made more transparent (than the most solid color allowed by collection_level_alpha)

In summary, I suggest to take the product of collection_level_alpha and A from RGBA when displaying. I wrote about that in a different context and that's what happens in Inkscape/Gimp when you set a transparency value on a layer that already contains RGBA colors.

@github-actions
Copy link

github-actions bot commented Apr 2, 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 Apr 2, 2023
@anntzer
Copy link
Contributor Author

anntzer commented Apr 2, 2023

I guess this would still be conceptually nice, but I don't really have the bandwidth to push this forward, so we may close this if no one else is interested.

@timhoffm
Copy link
Member

timhoffm commented Apr 2, 2023

The reasonable way forward would be using an internal Color class (and additionally ColorArray). This can abstract away all color handling aspects. - For example also the topic of (non-)normalization (what color representation do we return - the one that was provided or some standard (rgb(a)).

However this is not a priority. While not quite well structured, colors work reasonably well in practice.

@github-actions github-actions bot removed the status: inactive Marked by the “Stale” Github Action label Apr 3, 2023
@QuLogic
Copy link
Member

QuLogic commented Apr 6, 2023

@ksunden has added typing for, at least, the input of colours. While that does not specifically limit what gets used internally, it may inform the design of things here a bit.

Copy link

github-actions bot commented Apr 8, 2024

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 Apr 8, 2024
@timhoffm timhoffm added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: consistency keep Items to be ignored by the “Stale” Github Action topic: color/alpha
Projects
None yet
Development

No branches or pull requests

5 participants