Skip to content

Lazily resolve colors for Patches. #11711

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

Closed

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 20, 2018

See explanation in #11710 (which this closes).

This is consistent with Line2Ds and avoids complications with
original{face,edge}color.

test_patch_color_none was removed as it doesn't make much sense anymore
(fixing it would just mean testing that mcolors.to_rgba is working as
expected).

Also closes #11702; includes the test from #11703.

(We may also want to do the same thing with Collections.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

This is consistent with Line2Ds and avoids complications with
_original_{face,edge}color.

test_patch_color_none was removed as it doesn't make much sense anymore
(fixing it would just mean testing that mcolors.to_rgba is working as
expected).
@anntzer anntzer force-pushed the lazy-color-resolution-for-patches branch from 8b4626a to ec56a0c Compare July 20, 2018 09:09
@jklymak
Copy link
Member

jklymak commented Jul 20, 2018

I agree w. this change of behaviour. OTOH I think collections should get the same treatment to keep things consistent.

The only problem with returning the user's version of the colors is that they are not programatically trivial to parse out.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 21, 2018

collections are a bit more complicated because there you probably do want to have some kind of caching for performance reasons (as colors can be big arrays). I have some idea of how to do it but would prefer that we first agree on whether this is the direction we want to go.

@WeatherGod
Copy link
Member

Throwing in my 2 cents that lazy evaluation of the color cycle spec should be the goal. This stems from the concept that C0 is intended to be an alias, and we should not be replacing that alias with a resolved value under-the-hood unless the user does that. We encountered questions about this behavior before when a user pointed out a discrepancy in the plot output if the plt.show() was inside or outside a with context, and we previously agreed that that was a feature, not a bug, of the colorcycle spec notation.

@jklymak jklymak added this to the v3.1 milestone Oct 4, 2018
@jklymak
Copy link
Member

jklymak commented Oct 4, 2018

This should get some executive decision about whether is should be done before @anntzer rebases... I've put on the agenda for Monday...

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking on discussion in #12967

@jklymak
Copy link
Member

jklymak commented Feb 11, 2019

OK, I think we have decided that lazy evaluation is not wanted (and should probably be removed for line2d?

@anntzer
Copy link
Contributor Author

anntzer commented Feb 11, 2019

yes

@jklymak jklymak closed this Feb 11, 2019
@anntzer anntzer deleted the lazy-color-resolution-for-patches branch February 11, 2019 18:57
@QuLogic QuLogic removed this from the v3.1.0 milestone Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting alpha on legend handle changes patch color
5 participants