Skip to content

Internally dropping use of separate alpha value #7430

Open

Description

@anntzer

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.

Activity

  1. added this to the milestone on Nov 9, 2016
  2. added
    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …
    on Nov 9, 2016
  3. tacaswell commented on Nov 9, 2016

    @tacaswell
    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.

  4. anntzer commented on Nov 9, 2016

    @anntzer
    ContributorAuthor

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

  5. tacaswell commented on Nov 9, 2016

    @tacaswell
    Member

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

  6. anntzer commented on Nov 10, 2016

    @anntzer
    ContributorAuthor

    Good point.

  7. anntzer commented on Nov 21, 2016

    @anntzer
    ContributorAuthor

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

  8. tacaswell commented on Dec 20, 2016

    @tacaswell
    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.

  9. modified the milestones: , on Oct 3, 2017
  10. stippingerm commented on Jan 8, 2019

    @stippingerm

    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.

  11. github-actions commented on Apr 2, 2023

    @github-actions

    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!

  12. anntzer commented on Apr 2, 2023

    @anntzer
    ContributorAuthor

    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.

  13. timhoffm commented on Apr 2, 2023

    @timhoffm
    Member

    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.

  14. QuLogic commented on Apr 6, 2023

    @QuLogic
    Member

    @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.

  15. github-actions commented on Apr 8, 2024

    @github-actions

    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!

  16. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …keepItems to be ignored by the “Stale” Github Actiontopic: color/alpha

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions