[Bug]: ax.xaxis.set_label(...) doesn't set the x-axis label · Issue #27971 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: ax.xaxis.set_label(...) doesn't set the x-axis label #27971

Description

@dstansby

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 do ax.xaxis.set_label(...) instead of ax.set_xlabel(...). It seems like ax.xaxis.set_label(...) does not label the axis however.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.xaxis.set_label("x-label")

Actual outcome

Screenshot 2024-03-24 at 10 02 10

Expected outcome

Screenshot 2024-03-24 at 10 02 26

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

Activity

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

Metadata

Metadata

Assignees

Labels

API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions