Skip to content

[Bug]: set_text does not work when accessed from axis.get_xticklabels #28224

@hoxbro

Description

@hoxbro

Bug summary

I want to update the x-ticks label in a for loop with set_text, but it does not update the text.

Code for reproduction

import matplotlib.pyplot as plt

fig, axis = plt.subplots()
for t in axis.get_xticklabels():
    t.set_text('a')

plt.show()

Actual outcome

Nothing happens with the xticklabels.

Figure_1

Expected outcome

I would expect all ticks on x-axis to be labeled 'a'. It works if I use t.set_y with the offset.

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.4

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions