Skip to content

[Bug]: possible regression in axis ticks handling in matplotlib 3.6.0rc2 #23806

Closed
@neutrinoceros

Description

@neutrinoceros

Bug summary

While running image tests for yt, I noticed a change of behaviour that bisects to
2357c92d87d96d519c8470776e76180e71663d0b (PR #22587)
and that I'm not 100% sure is intentional, where parameters set with Axis.tick_params are forgotten after a call to Axes.cla.

In yt we use persistent Axis instances inside container classes; we typically set some tick_params during instantiation of the container, and defer rendering as much as possible, at which point Axis instances may be cleared before the plot is drawn again.

I think this can easily be fixed in yt, but I wanted to check with you wether this change was intented or not.

Code for reproduction

import matplotlib as mpl
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.tick_params(which="both", axis="both", direction="in", top=True, right=True)
ax.cla()
fig.savefig(f"/tmp/{mpl.__version__}.png")

Actual outcome

3 6 0 dev3625+g25b39d41d3

Expected outcome

with matplotlib 3.5
3 5 0rc2 dev89+g6e95e7bf54

Additional information

No response

Operating system

N/A

Matplotlib Version

3.6 VS 3.5

Matplotlib Backend

MacOSX (but also seeing this on a Linux CI server)

Python version

3.10.4

Jupyter version

N/A

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions