-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: ax.xaxis.set_label(...) doesn't set the x-axis label #27971
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
The method you are looking for is set_label is the inherited method from Artist which provides the text that would appear in a legend entry (odd to do for Axis, but is defined by Artist) However, confusingly, get_label is actually overridden with a different meaning in Axis, where it returns the Text instance of the label. (And so I might expect the setter to error with a raw string, but expect a Text instance) I will state that the "_text" postfix is itself confusing, because it is given a string and is opposed to the version which uses Text. |
Thanks - I thought something like that might be going on. Shall we close as won't fix then? Or we could keep open and as an action deprecate the overriden |
Please leave open. I will think about whether we can make this less confusing when I have a quiet minute. |
The name label is very broad and used for different things in different contexts. It would have been better to either be more specific
|
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
…atplotlib#28584) Closes matplotlib#27971. For a complete explanation see matplotlib#27971 (comment)
Bug summary
I'm used to using the Axis API like
ax.xaxis.set_major_formatter(...)
etc., so to be consistent it would be nice if one could doax.xaxis.set_label(...)
instead ofax.set_xlabel(...)
. It seems likeax.xaxis.set_label(...)
does not label the axis however.Code for reproduction
Actual outcome
Expected outcome
Additional information
No response
Operating system
No response
Matplotlib Version
3.8.3
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: