You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: labels argument cannot be None when kwargs are passed
Expected outcome
Two issues here: which='minor' is incorrect for set_yticks, I should have done minor=True. It's a bit annoying that which is the kwarg for some things and minor for set_yticks.
Second, the error message is somewhat annoying as I would have expected this call to work or give me an error for an incorrect kwarg.
Additional information
No response
Operating system
No response
Matplotlib Version
main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
The text was updated successfully, but these errors were encountered:
timhoffm
added a commit
to timhoffm/matplotlib
that referenced
this issue
Jul 10, 2023
The error message is technically correct. You are doing two wrong things at the same time:
Use an invalid kwarg.
Use a kwarg without labels. (kwargs are supposed to be passed to labels)
There's no obvious choice which error should get checked first. I suppose you would be less surprised for an (incorrect) kwarg intended to modify tick labels, set_xticks(ticks, textcolor='red'). The situation looks a bit more mysterious because you have chosen a kwarg name that's a synonym to the valid minor.
I suggest to change the exception message to
Incorrect use of keyword argument 'which'. Keyword arguments other than 'minor' modify the text labels and can only be passed if 'labels' are passed as well.
This should make the error more clear. -> PR incoming.
Note that we cannot easily check whether kwargs would be valid because we just pass them on to set_ticklabels (which we can't if the user has not given tick labels. Anyway the above wording should do.
Bug summary
set_yticks(ticks, which="minor")
errors withValueError: labels argument cannot be None when kwargs are passed
.Code for reproduction
Actual outcome
Expected outcome
Two issues here:
which='minor'
is incorrect forset_yticks
, I should have doneminor=True
. It's a bit annoying thatwhich
is the kwarg for some things andminor
forset_yticks
.Second, the error message is somewhat annoying as I would have expected this call to work or give me an error for an incorrect kwarg.
Additional information
No response
Operating system
No response
Matplotlib Version
main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
The text was updated successfully, but these errors were encountered: