8000 [MNT]: make Axes.cla an alias for Axes.clear in all cases · Issue #22738 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[MNT]: make Axes.cla an alias for Axes.clear in all cases #22738
Closed
@tacaswell

Description

@tacaswell

Summary

We have clf/clear and cla/clear as pairs of related but not quite the same methods an the Figure and Axes classes. The clf/clear pair has mostly been consolidated (and is fully in #22735 ), but the cla case is more work because we bunch of Axes subclasses in the code base. Long term I think every Axes subclass:

  • clear and cla should be identical
  • every subclass should have both
  • we should never use cla in the docs

I think ax.cla() is too widely used to be deprecated solely on the aesthetics grounds so we have to carry it and if one subclass has it they all should (in interest of them being as interchangeable as possible).

Labeling this as a good first issue because a bit of grep will find all of the places in the code that need to be touched and there is (should be) no API choices in this work, but medium difficulty because you should be comfortable moving around a new code base / have a solid grasp of OO inheritance.

Proposed fix

Following the pattern of #22735

  • consolidate all implementation undef a clear method
  • add cla = clear in the class bodies add a clear method to the base class
  • add test that this is always true add a test that subclasses do not override clf

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Maintenance

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0