Skip to content

[Bug]: set_position function of spine will affect the color of ticklabels #22672

@y9c

Description

@y9c

Bug summary

When .set_position() function is applied to the plot, color of the ticklabels will change.

Code for reproduction

Block A

fig, ax = plt.subplots()
ax.plot([1, 2, 3])
for lab in ax.get_yticklabels():
    lab.set_color("r")
fig.show()


Block B

```python
fig, ax = plt.subplots()
ax.plot([1, 2, 3])
for lab in ax.get_yticklabels():
    lab.set_color("r")
ax.spines.left.set_position(("outward", 10))
fig.show()

Actual outcome

When apply set_position function, the color will be reset.

Expected outcome

Color of yticklables should be red.

Additional information

No response

Operating system

No response

Matplotlib Version

3.5.0

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions