-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Draw RadioButtons using scatter to ensure circular buttons. #24455
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
Conversation
26580cc
to
fcfae34
Compare
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.
The fallback is very clever 👍.
To ensure backcompat without bothering the majority of users who don't actually access the .circles attribute, dynamically (and irreversibly) switch back to the old draw method (list of Circles) whenever that attribute is accessed for the first time (if ever).
What is the recommendation for those of us (MNE-Python) who do access the If it helps, here is an example of what we do with it: we actually access |
If I've understood what that code does, it appears that you set a radius so that the buttons are reasonably sized. And the second thing is setting specific edge colours for each radio? I think the former is something we should just do, and the latter (styling options) is a reasonable enhancement request if you want to open an issue? |
Another thing we do is apply transforms to ensure buttons are circular. That part should go be able to be removed after this PR, but we'll still want to be able to set size and linewidth (on all buttons uniformly) and set color, edgecolor, and opacity (on each button individually). I've opened #24583 for the feature request. |
To ensure backcompat without bothering the majority of users who don't actually access the .circles attribute, dynamically (and irreversibly) switch back to the old draw method (list of Circles) whenever that attribute is accessed for the first time (if ever).
https://matplotlib.org/stable/gallery/widgets/radio_buttons.html now looks like

Note that the buttons are now circular.
Closes #24428.
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst