Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f683fc7

Browse files
committed
Generalize Affine2DBase to AffineImmutable
1 parent eb17273 commit f683fc7

File tree

8 files changed

+142
-65
lines changed

8 files changed

+142
-65
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ def draw_image(self, gc, x, y, im, transform=None):
439439
im : (N, M, 4) array of `numpy.uint8`
440440
An array of RGBA pixels.
441441
442-
transform : `~matplotlib.transforms.Affine2DBase`
442+
transform : `~matplotlib.transforms.AffineImmutable`
443443
If and only if the concrete backend is written such that
444444
`option_scale_image` returns ``True``, an affine transformation
445-
(i.e., an `.Affine2DBase`) *may* be passed to `draw_image`. The
445+
(i.e., an `.AffineImmutable`) *may* be passed to `draw_image`. The
446446
translation vector of the transformation is given in physical units
447447
(i.e., dots or pixels). Note that the transformation does not
448448
override *x* and *y*, and has to be applied *before* translating

lib/matplotlib/backend_bases.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class RendererBase:
9191
x: float,
9292
y: float,
9393
im: ArrayLike,
94-
transform: transforms.Affine2DBase | None = ...,
94+
transform: transforms.AffineImmutable | None = ...,
9595
) -> None: ...
9696
def option_image_nocomposite(self) -> bool: ...
9797
def option_scale_image(self) -> bool: ...

lib/matplotlib/backends/backend_svg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from matplotlib.dates import UTC
2323
from matplotlib.path import Path
2424
from matplotlib import _path
25-
from matplotlib.transforms import Affine2D, Affine2DBase
25+
from matplotlib.transforms import Affine2D, AffineImmutable
2626

2727

2828
_log = logging.getLogger(__name__)
@@ -255,7 +255,7 @@ def _generate_transform(transform_list):
255255
or type == 'translate' and value == (0, 0)
256256
or type == 'rotate' and value == (0,)):
257257
continue
258-
if type == 'matrix' and isinstance(value, Affine2DBase):
258+
if type == 'matrix' and isinstance(value, AffineImmutable):
259259
value = value.to_values()
260260
parts.append('{}({})'.format(
261261
type, ' '.join(_short_float_fmt(x) for x in value)))

lib/matplotlib/path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,10 @@ def get_path_collection_extents(
10621062
master_transform : `~matplotlib.transforms.Transform`
10631063
Global transformation applied to all paths.
10641064
paths : list of `Path`
1065-
transforms : list of `~matplotlib.transforms.Affine2DBase`
1065+
transforms : list of `~matplotlib.transforms.AffineImmutable`
10661066
If non-empty, this overrides *master_transform*.
10671067
offsets : (N, 2) array-like
1068-
offset_transform : `~matplotlib.transforms.Affine2DBase`
1068+
offset_transform : `~matplotlib.transforms.AffineImmutable`
10691069
Transform applied to the offsets before offsetting the path.
10701070
10711071
Notes

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def inverted(self):
155155
)
156156

157157

158-
class PolarAffine(mtransforms.Affine2DBase):
158+
class PolarAffine(mtransforms.AffineImmutable):
159159
r"""
160160
The affine part of the polar projection.
161161
@@ -181,7 +181,7 @@ def __init__(self, scale_transform, limits):
181181
View limits of the data. The only part of its bounds that is used
182182
is the y limits (for the radius limits).
183183
"""
184-
super().__init__()
184+
super().__init__(dims=2)
185185
self._scale_transform = scale_transform
186186
self._limits = limits
187187
self.set_children(scale_transform, limits)

lib/matplotlib/projections/polar.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PolarTransform(mtransforms.Transform):
2323
) -> None: ...
2424
def inverted(self) -> InvertedPolarTransform: ...
2525

26-
class PolarAffine(mtransforms.Affine2DBase):
26+
class PolarAffine(mtransforms.AffineImmutable):
2727
def __init__(
2828
self, scale_transform: mtransforms.Transform, limits: mtransforms.BboxBase
2929
) -> None: ...

0 commit comments

Comments
 (0)