Skip to content

Commit 9bed666

Browse files
committed
Deprecated _apply_theta_transforms=True
1 parent e9d1f9c commit 9bed666

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Applying theta transforms in ``PolarTransform``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Applying theta transforms in `~matplotlib.projections.polar.PolarTransform`
4+
is deprecated. This is currently the default behaviour, so to prevent
5+
a warning, manually pass ``_apply_theta_transforms=False``, and
6+
apply any theta shift before passing points to this transform.

lib/matplotlib/projections/polar.py

+11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ def __init__(self, axis=None, use_rmin=True,
3535
self._axis = axis
3636
self._use_rmin = use_rmin
3737
self._apply_theta_transforms = _apply_theta_transforms
38+
if _apply_theta_transforms:
39+
_api.warn_deprecated(
40+
"3.7",
41+
message=(
42+
"Passing `_apply_theta_transforms=True` (the default) "
43+
"is deprecated. Support for this will be removed in "
44+
"Matplotlib %(removal)s. To prevent this warning, "
45+
"set `_apply_theta_transforms=False`, and make sure to "
46+
"shift theta values before being passed to this transform."
47+
)
48+
)
3849

3950
__str__ = mtransforms._make_str_method(
4051
"_axis",

lib/matplotlib/text.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ def _get_xy_transform(self, renderer, s):
15081508
return self.axes.transData
15091509
elif s == 'polar':
15101510
from matplotlib.projections import PolarAxes
1511-
tr = PolarAxes.PolarTransform()
1511+
tr = PolarAxes.PolarTransform(_apply_theta_transforms=False)
15121512
trans = tr + self.axes.transData
15131513
return trans
15141514

lib/mpl_toolkits/axisartist/tests/test_floating_axes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_curvelinear3():
2424
fig = plt.figure(figsize=(5, 5))
2525

2626
tr = (mtransforms.Affine2D().scale(np.pi / 180, 1) +
27-
mprojections.PolarAxes.PolarTransform())
27+
mprojections.PolarAxes.PolarTransform(_apply_theta_transforms=False))
2828
grid_helper = GridHelperCurveLinear(
2929
tr,
3030
extremes=(0, 360, 10, 3),
@@ -73,7 +73,7 @@ def test_curvelinear4():
7373
fig = plt.figure(figsize=(5, 5))
7474

7575
tr = (mtransforms.Affine2D().scale(np.pi / 180, 1) +
76-
mprojections.PolarAxes.PolarTransform())
76+
mprojections.PolarAxes.PolarTransform(_apply_theta_transforms=False))
7777
grid_helper = GridHelperCurveLinear(
7878
tr,
7979
extremes=(120, 30, 10, 0),

lib/mpl_toolkits/axisartist/tests/test_grid_helper_curvelinear.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def test_polar_box():
8484

8585
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
8686
# system in degree
87-
tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
87+
tr = (Affine2D().scale(np.pi / 180., 1.) +
88+
PolarAxes.PolarTransform(_apply_theta_transforms=False))
8889

8990
# polar projection, which involves cycle, and also has limits in
9091
# its coordinates, needs a special method to find the extremes
@@ -146,7 +147,8 @@ def test_axis_direction():
146147

147148
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
148149
# system in degree
149-
tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
150+
tr = (Affine2D().scale(np.pi / 180., 1.) +
151+
PolarAxes.PolarTransform(_apply_theta_transforms=False))
150152

151153
# polar projection, which involves cycle, and also has limits in
152154
# its coordinates, needs a special method to find the extremes

0 commit comments

Comments
 (0)