Skip to content

[ENH]: Set color of legend shadow #24663

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
oscargus opened this issue Dec 8, 2022 · 5 comments · Fixed by #24666
Closed

[ENH]: Set color of legend shadow #24663

oscargus opened this issue Dec 8, 2022 · 5 comments · Fixed by #24666
Labels
Good first issue Open a pull request against these issues if there are no active ones! New feature topic: legend
Milestone

Comments

@oscargus
Copy link
Member

oscargus commented Dec 8, 2022

Problem

There was a PR to set the shadow color for legend which is now closed: #18668

Proposed solution

Revive that PR. The fair thing to do is to add a Co-authored-by with the original author even if it looks like you will have to copy-and-paste the code. (If you rewrite it independently, there is of course no need to do that.)

Note that there are still some review comments left to handle.

@oscargus oscargus added New feature Good first issue Open a pull request against these issues if there are no active ones! topic: legend labels Dec 8, 2022
@tuncbkose
Copy link
Contributor

I was thinking of reviving the linked PR, but I saw something that confused me a bit.
In a code like ax.legend(shadow="y") should "y" be interpreted as "yellow" or True (as in yes)?

More generally, in test_rcparams.py, there are some expressions (under validate_bool) that presumably should be accepted as booleans:

('t', 'y', 'yes', 'on', 'true', '1', 1, True)
('f', 'n', 'no', 'off', 'false', '0', 0, False)

Is there a principled way to check if a shadow argument is one of these beyond just copy-pasting the tuple? Or is something like

if is_color_like(shadow):
    ...
elif shadow in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
    ...
elif shadow in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
    pass
else:
    raise ValueError('shadow must be a valid color or bool')

good enough?

@oscargus
Copy link
Member Author

oscargus commented Dec 8, 2022

I believe that one should differentiate between the rcparams and passing the argument to legend.

For rcparams there will indeed be a bit of a clash for 'y' and, I think, 1 and 0. Can be worthwhile noting this in the docs.

For legend=..., only True/False are valid, so there it shouldn't be a problem.

I think the current code deals with it quite OK, but one should probably document the possible clashes somewhere and how it behaves.

@anntzer
Copy link
Contributor

anntzer commented Dec 8, 2022

I think deprecating the interpretation of t/f/y/n as bools in rcparams would be reasonable too.

@rcomer rcomer linked a pull request Dec 23, 2022 that will close this issue
5 tasks
@Shikharishere
Copy link

is this issue still open? If yes I would like take it.......

@tuncbkose
Copy link
Contributor

There is already some work done and discussion in the linked pull request. I was hoping to finish it next week but feel free to help if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Open a pull request against these issues if there are no active ones! New feature topic: legend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants