Skip to content

[Bug]: Typo in method name: contains_branch_separately #30474

@brchristian

Description

@brchristian

Bug summary

There is a typo in the method name contains_branch_seperately from lib/matplotlib/transforms.py:

def contains_branch_seperately(self, other_transform):

This should be spelled contains_branch_separately (separate not seperate).

Since this is a public API method, I propose:

  1. Rename the method to contains_branch_separately (correct spelling)
  2. Create an alias from the old contains_branch_seperately spelling to the new method for backwards compatibility
  3. Add a deprecation warning when the old name is used
  4. Update any internal uses and documentation to use the correct spelling

Happy to prepare a PR for this if that makes sense!

Code for reproduction

# Copied from lib/matplotlib/transforms.py

    def contains_branch_seperately(self, other_transform):
        """
        Return whether the given branch is a sub-tree of this transform on
        each separate dimension.

        A common use for this method is to identify if a transform is a blended
        transform containing an Axes' data transform. e.g.::

            x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)

        """
        if self.output_dims != 2:
            raise ValueError('contains_branch_seperately only supports '
                             'transforms with 2 output dimensions')
        # for a non-blended transform each separate dimension is the same, so
        # just return the appropriate shape.
        return (self.contains_branch(other_transform), ) * 2

Actual outcome

Code runs as expected, but method name contains a typo.

Expected outcome

Method name should be correctly spelled as contains_branch_separately

Additional information

No response

Operating system

No response

Matplotlib Version

Current main branch, as of a3fcf0b (25 August 2025)

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions