Skip to content

Commit ce295ee

Browse files
authored
Merge pull request #16129 from anntzer/dscale
Deprecate some Transform aliases in scale.py.
2 parents d5f3571 + a46f508 commit ce295ee

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,10 @@ The following parameters do not have any effect and are deprecated:
124124
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125125
This method is deprecated. Use
126126
``ax.dataLim.set(Bbox.union([ax.dataLim, bounds]))`` instead.
127+
128+
``{,Symmetrical}LogScale.{,Inverted}LogTransform``
129+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
``LogScale.LogTransform``, ``LogScale.InvertedLogTransform``,
131+
``SymmetricalScale.SymmetricalTransform`` and
132+
``SymmetricalScale.InvertedSymmetricalTransform`` are deprecated. Directly
133+
access the transform classes from the :mod:`.scale` module.

lib/matplotlib/scale.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,16 @@ class LogScale(ScaleBase):
344344
InvertedLog2Transform = InvertedLog2Transform
345345
NaturalLogTransform = NaturalLogTransform
346346
InvertedNaturalLogTransform = InvertedNaturalLogTransform
347-
LogTransform = LogTransform
348-
InvertedLogTransform = InvertedLogTransform
347+
348+
@cbook.deprecated("3.3", alternative="scale.LogTransform")
349+
@property
350+
def LogTransform(self):
351+
return LogTransform
352+
353+
@cbook.deprecated("3.3", alternative="scale.InvertedLogTransform")
354+
@property
355+
def InvertedLogTransform(self):
356+
return InvertedLogTransform
349357

350358
def __init__(self, axis, **kwargs):
351359
"""
@@ -535,9 +543,17 @@ class SymmetricalLogScale(ScaleBase):
535543
the logarithmic range.
536544
"""
537545
name = 'symlog'
538-
# compatibility shim
539-
SymmetricalLogTransform = SymmetricalLogTransform
540-
InvertedSymmetricalLogTransform = InvertedSymmetricalLogTransform
546+
547+
@cbook.deprecated("3.3", alternative="scale.SymmetricalLogTransform")
548+
@property
549+
def SymmetricalLogTransform(self):
550+
return SymmetricalLogTransform
551+
552+
@cbook.deprecated(
553+
"3.3", alternative="scale.InvertedSymmetricalLogTransform")
554+
@property
555+
def InvertedSymmetricalLogTransform(self):
556+
return InvertedSymmetricalLogTransform
541557

542558
def __init__(self, axis, **kwargs):
543559
if axis.axis_name == 'x':

lib/matplotlib/tests/test_transforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
assert_array_equal, assert_array_almost_equal)
44
import pytest
55

6+
from matplotlib import scale
67
import matplotlib.pyplot as plt
78
import matplotlib.patches as mpatches
89
import matplotlib.transforms as mtransforms
910
from matplotlib.path import Path
10-
from matplotlib.scale import LogScale
1111
from matplotlib.testing.decorators import image_comparison
1212

1313

@@ -196,7 +196,7 @@ def test_clipping_of_log():
196196

197197
# something like this happens in plotting logarithmic histograms
198198
trans = mtransforms.BlendedGenericTransform(
199-
mtransforms.Affine2D(), LogScale.LogTransform(10, 'clip'))
199+
mtransforms.Affine2D(), scale.LogTransform(10, 'clip'))
200200
tpath = trans.transform_path_non_affine(path)
201201
result = tpath.iter_segments(trans.get_affine(),
202202
clip=(0, 0, 100, 100),

0 commit comments

Comments
 (0)