Draw RadioButtons using scatter to ensure circular buttons.#24455
Draw RadioButtons using scatter to ensure circular buttons.#24455ksunden merged 1 commit intomatplotlib:mainfrom
Conversation
26580cc to
fcfae34
Compare
timhoffm
left a comment
There was a problem hiding this comment.
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
pytestpasses).flake8-docstringsand 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.rstornext_api_changes/README.rst