Draw RadioButtons using scatter to ensure circular buttons. by anntzer · Pull Request #24455 · matplotlib/matplotlib · GitHub
Skip to content

Draw RadioButtons using scatter to ensure circular buttons. - #24455

Merged
ksunden merged 1 commit into
matplotlib:mainfrom
anntzer:rb
Nov 15, 2022
Merged

Draw RadioButtons using scatter to ensure circular buttons.#24455
ksunden merged 1 commit into
matplotlib:mainfrom
anntzer:rb

Conversation

@anntzer

@anntzer anntzer commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

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
test
Note that the buttons are now circular.

Closes #24428.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

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).
@drammock

drammock commented Nov 17, 2022

Copy link
Copy Markdown

@QuLogic

QuLogic commented Dec 2, 2022

Copy link
Copy Markdown
Member

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?

@drammock

drammock commented Dec 2, 2022

Copy link
Copy Markdown

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.

[Bug]: RadioButtons should be circular, not elliptic

7 participants