Skip to content

[Bug]: Axes.clear does not reset axislabel or ticklabel sizes #21239

Closed

Description

@anntzer

Bug summary

After clear()ing an Axes, custom axislabel or ticklabel sizes persist.

Code for reproduction

from pylab import *
ax = gca(); ax.set_xlabel("foo", size=16); ax.tick_params(labelsize=16); ax.clear(); ax.set_xlabel("foo")

Actual outcome

test

Expected outcome

The axislabel and ticklabels revert to the default size. (I think that's a saner behavior? Otherwise we should properly document what clear() resets and what it doesn't.)

Operating system

archlinux

Matplotlib Version

3.5.0.dev2168+g3b7b3a5a6f

Matplotlib Backend

any

Python version

39

Jupyter version

No response

Other libraries

No response

Installation

No response

Conda channel

No response

Activity

  1. jklymak commented on Oct 4, 2021

    @jklymak
    Member

    If we are planning to change the existing behaviour, I think this needs a comprehensive decision of what ax.clear is supposed to mean, and some proper tests....

  2. github-actions commented on Nov 5, 2025

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  3. anntzer commented on Nov 5, 2025

    @anntzer
    ContributorAuthor

    Likely fixed by #21253.

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

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