Skip to content

Commit b448209

Browse files
committed
Deprecated _apply_theta_transforms=True
1 parent e5a85f9 commit b448209

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed
Lines changed: 6 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ def __init__(self, axis=None, use_rmin=True,
5252
self._use_rmin = use_rmin
5353
self._apply_theta_transforms = _apply_theta_transforms
5454
self._scale_transform = scale_transform
55+
if _apply_theta_transforms:
56+
_api.warn_deprecated(
57+
"3.7",
58+
message=(
59+
"Passing `_apply_theta_transforms=True` (the default) "
60+
"is deprecated. Support for this will be removed in "
61+
"Matplotlib %(removal)s. To prevent this warning, "
62+
"set `_apply_theta_transforms=False`, and make sure to "
63+
"shift theta values before being passed to this transform."
64+
)
65+
)
5566

5667
__str__ = mtransforms._make_str_method(
5768
"_axis",

lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ def _get_xy_transform(self, renderer, coords):
14971497
return self.axes.transData
14981498
elif coords == 'polar':
14991499
from matplotlib.projections import PolarAxes
1500-
tr = PolarAxes.PolarTransform()
1500+
tr = PolarAxes.PolarTransform(_apply_theta_transforms=False)
15011501
trans = tr + self.axes.transData
15021502
return trans
15031503

lib/mpl_toolkits/axisartist/tests/test_floating_axes.py

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def test_polar_box():
8282

8383
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
8484
# system in degree
85-
tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
85+
tr = (Affine2D().scale(np.pi / 180., 1.) +
86+
PolarAxes.PolarTransform(_apply_theta_transforms=False))
8687

8788
# polar projection, which involves cycle, and also has limits in
8889
# its coordinates, needs a special method to find the extremes
@@ -144,7 +145,8 @@ def test_axis_direction():
144145

145146
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
146147
# system in degree
147-
tr = Affine2D().scale(np.pi / 180., 1.) + PolarAxes.PolarTransform()
148+
tr = (Affine2D().scale(np.pi / 180., 1.) +
149+
PolarAxes.PolarTransform(_apply_theta_transforms=False))
148150

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

0 commit comments

Comments
 (0)