Skip to content

Commit

Permalink
Add deprecation warnings for 2D classes
Browse files Browse the repository at this point in the history
  • Loading branch information
AnsonTran committed Apr 20, 2024
1 parent d2f66fe commit 74dbb4f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
15 changes: 15 additions & 0 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,11 @@ def inverted(self):
return self._inverted


@_api.deprecated("3.9", alternative="AffineImmutable")
class Affine2DBase(AffineImmutable):
pass


def _affine_factory(mtx, dims, *args, **kwargs):
if dims == 2:
return Affine2D(mtx, *args, **kwargs)
Expand Down Expand Up @@ -2396,6 +2401,11 @@ def get_matrix(self):
return self._mtx


@_api.deprecated("3.9", alternative="BlendedAffine")
class BlendedAffine2D(BlendedAffine):
pass


def blended_transform_factory(*args):
"""
Create a new "blended" transform using *x_transform* to transform
Expand Down Expand Up @@ -2567,6 +2577,11 @@ def get_matrix(self):
return self._mtx


@_api.deprecated("3.9", alternative="CompositeAffine")
class CompositeAffine2D(CompositeAffine):
pass


def composite_transform_factory(a, b):
"""
Create a new composite transform that is the result of applying
Expand Down
13 changes: 10 additions & 3 deletions lib/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ class AffineImmutable(AffineBase):
def frozen(self) -> AffineImmutable: ...
def to_values(self) -> tuple[float]: ...

class Affine2DBase(AffineImmutable):
pass

class Affine2D(AffineImmutable):
def __init__(self, matrix: ArrayLike | None = ..., **kwargs) -> None: ...
@staticmethod
Expand Down Expand Up @@ -266,9 +269,10 @@ class BlendedGenericTransform(_BlendedMixin, Transform):
def is_affine(self) -> bool: ...

class BlendedAffine(_BlendedMixin, AffineImmutable):
def __init__(
self, *args: Transform, **kwargs
) -> None: ...
def __init__(self, *args: Transform, **kwargs) -> None: ...

class BlendedAffine2D(BlendedAffine):
pass

def blended_transform_factory(
*args: Transform
Expand All @@ -283,6 +287,9 @@ class CompositeAffine(AffineImmutable):
@property
def depth(self) -> int: ...

class CompositeAffine2D(CompositeAffine):
pass

def composite_transform_factory(a: Transform, b: Transform) -> Transform: ...

class BboxTransform(AffineImmutable):
Expand Down

0 comments on commit 74dbb4f

Please sign in to comment.