Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ksunden merged 1 commit intomatplotlib:mainfromanntzer:rb
Nov 15, 2022

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedNov 14, 2022
edited
Loading

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 (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild 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 indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

Copy link
Member

@timhoffmtimhoffm left a 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'tactually access the .circles attribute, dynamically (and irreversibly)switch back to the old draw method (list of Circles) whenever thatattribute is accessed for the first time (if ever).
@drammock
Copy link

drammock commentedNov 17, 2022
edited
Loading

What is the recommendation for those of us (MNE-Python) whodo access the.circles property? AFAICT from the diff there isn't an alternative in the public API ofRadioButtons after this PR (but maybe I'm not looking carefully enough?)

If it helps, here is an example of what we do with it:

https://github.com/mne-tools/mne-python/blob/e65e5e5b49a7cdc21fb42d4a92bca5bd7a4e4329/mne/viz/_mpl_figure.py#L1050-L1061

we actually access.circles ten times in that file; some of them are simple one-liners to get a button's color, others are more complex like the snippet above.

@QuLogic
Copy link
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 reacted with thumbs up emoji

@drammock
Copy link

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ksundenksundenksunden approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

[Bug]: RadioButtons should be circular, not elliptic
7 participants
@anntzer@drammock@QuLogic@tacaswell@ksunden@timhoffm@raamana

[8]ページ先頭

©2009-2025 Movatter.jp