8000 Deprecate some Transform aliases in scale.py. by anntzer · Pull Request #16129 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Deprecate some Transform aliases in scale.py. #16129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,10 @@ The following parameters do not have any effect and are deprecated:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method is deprecated. Use
``ax.dataLim.set(Bbox.union([ax.dataLim, bounds]))`` instead.

``{,Symmetrical}LogScale.{,Inverted}LogTransform``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``LogScale.LogTransform``, ``LogScale.InvertedLogTransform``,
``SymmetricalScale.SymmetricalTransform`` and
``SymmetricalScale.InvertedSymmetricalTransform`` are deprecated. Directly
access the transform classes from the :mod:`.scale` module.
26 changes: 21 additions & 5 deletions lib/matplotlib/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,16 @@ class LogScale(ScaleBase):
InvertedLog2Transform = InvertedLog2Transform
NaturalLogTransform = NaturalLogTransform
InvertedNaturalLogTransform = InvertedNaturalLogTransform
LogTransform = LogTransform
InvertedLogTransform = InvertedLogTransform

@cbook.deprecated("3.3", alternative="scale.LogTransform")
@property
def LogTransform(self):
return LogTransform

@cbook.deprecated("3.3", alternative="scale.InvertedLogTransform")
@property
def InvertedLogTransform(self):
return InvertedLogTransform

def __init__(self, axis, **kwargs):
"""
Expand Down Expand Up @@ -535,9 +543,17 @@ class SymmetricalLogScale(ScaleBase):
the logarithmic range.
"""
name = 'symlog'
# compatibility shim
SymmetricalLogTransform = SymmetricalLogTransform
InvertedSymmetricalLogTransform = InvertedSymmetricalLogTransform

@cbook.deprecated("3.3", alternative="scale.SymmetricalLogTransform")
@property
def SymmetricalLogTransform(self):
return SymmetricalLogTransform

@cbook.deprecated(
"3.3", alternative="scale.InvertedSymmetricalLogTransform")
@property
def InvertedSymmetricalLogTransform(self):
return InvertedSymmetricalLogTransform

def __init__(self, axis, **kwargs):
if axis.axis_name == 'x':
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
assert_array_equal, assert_array_almost_equal)
import pytest

from matplotlib import scale
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.transforms as mtransforms
from matplotlib.path import Path
from matplotlib.scale import LogScale
from matplotlib.testing.decorators import image_comparison


Expand Down Expand Up @@ -196,7 +196,7 @@ def test_clipping_of_log():

# something like this happens in plotting logarithmic histograms
trans = mtransforms.BlendedGenericTransform(
mtransforms.Affine2D(), LogScale.LogTransform(10, 'clip'))
mtransforms.Affine2D(), scale.LogTransform(10, 'clip'))
tpath = trans.transform_path_non_affine(path)
result = tpath.iter_segments(trans.get_affine(),
clip=(0, 0, 100, 100),
Expand Down
0