Skip to content
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

Add useful error message when trying to add Slider to 3DAxes #15171

Merged
merged 1 commit into from Sep 2, 2019

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Sep 2, 2019

Before the error message would have been:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    valk = Slider(ax, 'kparam', 0, 30.0, valinit=1.0)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/widgets.py", line 381, in __init__
    horizontalalignment='right')
TypeError: text() missing 1 required positional argument: 's'

Now it is

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    valk = Slider(ax, 'kparam', 0, 30.0, valinit=1.0)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/widgets.py", line 324, in __init__
    raise ValueError('Sliders cannot be added to 3D Axes')
ValueError: Sliders cannot be added to 3D Axes

I was wondering if this should be a more strict test for ax.name != 'rectilinear' instead, but sliders with at least a polar projection do seem to work (modulo some drawing issues).

Closes #15156

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.2.0 milestone Sep 2, 2019
@tacaswell tacaswell merged commit e34f7ee into matplotlib:master Sep 2, 2019
@dstansby dstansby deleted the 3dslider branch September 3, 2019 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ax.text fails with positional argument error
3 participants