15
15
from matplotlib .spines import Spine
16
16
17
17
18
+ def _apply_theta_transforms_warn ():
19
+ _api .warn_deprecated (
20
+ "3.9" ,
21
+ message = (
22
+ "Passing `apply_theta_transforms=True` (the default) "
23
+ "is deprecated since Matplotlib %(since)s. "
24
+ "Support for this will be removed in Matplotlib %(removal)s. "
25
+ "To prevent this warning, set `apply_theta_transforms=False`, "
26
+ "and make sure to shift theta values before being passed to "
27
+ "this transform."
28
+ )
29
+ )
30
+
31
+
18
32
class PolarTransform (mtransforms .Transform ):
19
33
r"""
20
34
The base polar transform.
@@ -34,8 +48,8 @@ class PolarTransform(mtransforms.Transform):
34
48
35
49
input_dims = output_dims = 2
36
50
37
- def __init__ (self , axis = None , use_rmin = True ,
38
- _apply_theta_transforms = True , * , scale_transform = None ):
51
+ def __init__ (self , axis = None , use_rmin = True , * ,
52
+ apply_theta_transforms = True , scale_transform = None ):
39
53
"""
40
54
Parameters
41
55
----------
@@ -50,13 +64,15 @@ def __init__(self, axis=None, use_rmin=True,
50
64
super ().__init__ ()
51
65
self ._axis = axis
52
66
self ._use_rmin = use_rmin
53
- self ._apply_theta_transforms = _apply_theta_transforms
67
+ self ._apply_theta_transforms = apply_theta_transforms
54
68
self ._scale_transform = scale_transform
69
+ if apply_theta_transforms :
70
+ _apply_theta_transforms_warn ()
55
71
56
72
__str__ = mtransforms ._make_str_method (
57
73
"_axis" ,
58
74
use_rmin = "_use_rmin" ,
59
- _apply_theta_transforms = "_apply_theta_transforms" )
75
+ apply_theta_transforms = "_apply_theta_transforms" )
60
76
61
77
def _get_rorigin (self ):
62
78
# Get lower r limit after being scaled by the radial scale transform
@@ -133,8 +149,10 @@ def transform_path_non_affine(self, path):
133
149
134
150
def inverted (self ):
135
151
# docstring inherited
136
- return PolarAxes .InvertedPolarTransform (self ._axis , self ._use_rmin ,
137
- self ._apply_theta_transforms )
152
+ return PolarAxes .InvertedPolarTransform (
153
+ self ._axis , self ._use_rmin ,
154
+ apply_theta_transforms = self ._apply_theta_transforms
155
+ )
138
156
139
157
140
158
class PolarAffine (mtransforms .Affine2DBase ):
@@ -193,7 +211,7 @@ class InvertedPolarTransform(mtransforms.Transform):
193
211
input_dims = output_dims = 2
194
212
195
213
def __init__ (self , axis = None , use_rmin = True ,
196
- _apply_theta_transforms = True ):
214
+ * , apply_theta_transforms = True ):
197
215
"""
198
216
Parameters
199
217
----------
@@ -208,12 +226,14 @@ def __init__(self, axis=None, use_rmin=True,
208
226
super ().__init__ ()
209
227
self ._axis = axis
210
228
self ._use_rmin = use_rmin
211
- self ._apply_theta_transforms = _apply_theta_transforms
229
+ self ._apply_theta_transforms = apply_theta_transforms
230
+ if apply_theta_transforms :
231
+ _apply_theta_transforms_warn ()
212
232
213
233
__str__ = mtransforms ._make_str_method (
214
234
"_axis" ,
215
235
use_rmin = "_use_rmin" ,
216
- _apply_theta_transforms = "_apply_theta_transforms" )
236
+ apply_theta_transforms = "_apply_theta_transforms" )
217
237
218
238
@_api .rename_parameter ("3.8" , "xy" , "values" )
219
239
def transform_non_affine (self , values ):
@@ -234,8 +254,10 @@ def transform_non_affine(self, values):
234
254
235
255
def inverted (self ):
236
256
# docstring inherited
237
- return PolarAxes .PolarTransform (self ._axis , self ._use_rmin ,
238
- self ._apply_theta_transforms )
257
+ return PolarAxes .PolarTransform (
258
+ self ._axis , self ._use_rmin ,
259
+ apply_theta_transforms = self ._apply_theta_transforms
260
+ )
239
261
240
262
241
263
class ThetaFormatter (mticker .Formatter ):
@@ -879,7 +901,7 @@ def _set_lim_and_transforms(self):
879
901
# data. This one is aware of rmin
880
902
self .transProjection = self .PolarTransform (
881
903
self ,
882
- _apply_theta_transforms = False ,
904
+ apply_theta_transforms = False ,
883
905
scale_transform = self .transScale
884
906
)
885
907
# Add dependency on rorigin.
0 commit comments