-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Corrected the slider handle styling #27674
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
handle_style = {} if handle_style is None else handle_style | ||
marker_props = { | ||
f'marker{k}': v for k, v in {**defaults, **handle_style}.items() | ||
f'{"marker" * (not k.startswith("marker")) + k}': v \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion would broaden the API so that we'd accept handle_style={'markerfacecolor': ...}
. It would be a separate debate whether that is reasonable, and it would also create some ambiguity handle_style={'markerfacecolor': 'r', 'facecolor': 'g'}
. So for now, I suggest to only expand to accept "marker":
f'{"marker" * (not k.startswith("marker")) + k}': v \ | |
f'{"marker" * (k != marker) + k}': v |
Also this arithmethic is quite clever and we might want to be more explcit
def prefix_marker(key):
return key if key == "marker" else "marker" + key
makrer_props = {
prefix_marker(k): v for ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comments, they are very insightful and so to the point. I absolutely agree with everything you said :)
Would you mind pointing out to where this 'prefix_marker' function should be defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be a nested function unless we have some other place to use it, and it'd be more for self-documentation.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
PR summary
resolves #27672
The slider handle marker style can now be provided in handle_style dict with
"marker: "^"
.It still defaults to
"o"
.PR checklist