-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: RadioButtons should be circular, not elliptic #24428
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
Comments
I don't think you should enforce an equal aspect of the Axes box. This would lead to scaling the height of the box when you change the width of the figure. This (i) not how GUI elements normally behave and (ii) can lead to vertical shrinking and thus vertical text overlap. If you play the aspect game, I think it would need to be in data coordinates. - But that means, changing Circle and Text coords to data, which is technically a breaking change as well.
Using markers may actually be a good idea because they are in (i think) points, so that they have a constant size just as the Text. Either way, if compatibility is a concern, it may be a reasonable approach to create a new |
I think(?) you can prevent this with set_adjustable("datalim")? |
This will only affect the circle if you switch to specifying the circle in data coordinates. As long as the circle stays in axes coordinates, the datalims will happily scale beneath it without any visual effect. |
Do the sliders change aspect when the figure is changed? These should be in figure physical units (points) shouldn't they? |
Sliders cover an entire axes, so it comes down to how you specified the axes? But most likely (whether it's an add_subplot() or an add_axes()) they will indeed change aspect in that case. |
Note that the same issue also affects CheckButtons, and from a quick try one can use a solution similar to #24455 (using two series of scatters, one with marker="s" and the other with marker="x", with the color varying on the latter); it may be a good idea to make that a good first issue once #24455 is merged, suggesting to take that PR as example of how to fix it. |
Or maybe somebody want's to create a fancy CheckMarker class for this ☑️ 😀 |
Bug summary
RadioButtons are drawn as Circles in transAxes space, which means that as soon as the containing Axes is not equal-aspect, they will actually be elliptical, not circular.
In order to fix this, either the parent axes must be forced to be equal-aspect (we already remove the ticks and the navigatability, so more configuration may be OK), or we should use add functionality to Circle so that the center and the radius can be in different transform systems (center in transAxes, radius in pixels) -- or abuse scatter() instead to draw the radiobuttons (but this would break the
radiobuttons.circles
attribute).Code for reproduction
Actual outcome
radio buttons are elliptical
Expected outcome
radio buttons stay circular
Additional information
No response
Operating system
fedora37
Matplotlib Version
3.7.0.dev619+g3d6c3da884
Matplotlib Backend
any
Python version
3.10
Jupyter version
ENOSUCHLIB
Installation
git checkout
The text was updated successfully, but these errors were encountered: