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 in %(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
-
32
18
class PolarTransform (mtransforms .Transform ):
33
19
r"""
34
20
The base polar transform.
@@ -48,8 +34,7 @@ class PolarTransform(mtransforms.Transform):
48
34
49
35
input_dims = output_dims = 2
50
36
51
- def __init__ (self , axis = None , use_rmin = True , * ,
52
- apply_theta_transforms = True , scale_transform = None ):
37
+ def __init__ (self , axis = None , use_rmin = True , * , scale_transform = None ):
53
38
"""
54
39
Parameters
55
40
----------
@@ -64,15 +49,12 @@ def __init__(self, axis=None, use_rmin=True, *,
64
49
super ().__init__ ()
65
50
self ._axis = axis
66
51
self ._use_rmin = use_rmin
67
- self ._apply_theta_transforms = apply_theta_transforms
68
52
self ._scale_transform = scale_transform
69
- if apply_theta_transforms :
70
- _apply_theta_transforms_warn ()
71
53
72
54
__str__ = mtransforms ._make_str_method (
73
55
"_axis" ,
74
- use_rmin = "_use_rmin" ,
75
- apply_theta_transforms = "_apply_theta_transforms" )
56
+ use_rmin = "_use_rmin"
57
+ )
76
58
77
59
def _get_rorigin (self ):
78
60
# Get lower r limit after being scaled by the radial scale transform
@@ -82,11 +64,6 @@ def _get_rorigin(self):
82
64
def transform_non_affine (self , values ):
83
65
# docstring inherited
84
66
theta , r = np .transpose (values )
85
- # PolarAxes does not use the theta transforms here, but apply them for
86
- # backwards-compatibility if not being used by it.
87
- if self ._apply_theta_transforms and self ._axis is not None :
88
- theta *= self ._axis .get_theta_direction ()
89
- theta += self ._axis .get_theta_offset ()
90
67
if self ._use_rmin and self ._axis is not None :
91
68
r = (r - self ._get_rorigin ()) * self ._axis .get_rsign ()
92
69
r = np .where (r >= 0 , r , np .nan )
@@ -148,10 +125,7 @@ def transform_path_non_affine(self, path):
148
125
149
126
def inverted (self ):
150
127
# docstring inherited
151
- return PolarAxes .InvertedPolarTransform (
152
- self ._axis , self ._use_rmin ,
153
- apply_theta_transforms = self ._apply_theta_transforms
154
- )
128
+ return PolarAxes .InvertedPolarTransform (self ._axis , self ._use_rmin )
155
129
156
130
157
131
class PolarAffine (mtransforms .Affine2DBase ):
@@ -209,8 +183,7 @@ class InvertedPolarTransform(mtransforms.Transform):
209
183
"""
210
184
input_dims = output_dims = 2
211
185
212
- def __init__ (self , axis = None , use_rmin = True ,
213
- * , apply_theta_transforms = True ):
186
+ def __init__ (self , axis = None , use_rmin = True ):
214
187
"""
215
188
Parameters
216
189
----------
@@ -225,37 +198,24 @@ def __init__(self, axis=None, use_rmin=True,
225
198
super ().__init__ ()
226
199
self ._axis = axis
227
200
self ._use_rmin = use_rmin
228
- self ._apply_theta_transforms = apply_theta_transforms
229
- if apply_theta_transforms :
230
- _apply_theta_transforms_warn ()
231
201
232
202
__str__ = mtransforms ._make_str_method (
233
203
"_axis" ,
234
- use_rmin = "_use_rmin" ,
235
- apply_theta_transforms = "_apply_theta_transforms" )
204
+ use_rmin = "_use_rmin" )
236
205
237
206
def transform_non_affine (self , values ):
238
207
# docstring inherited
239
208
x , y = values .T
240
209
r = np .hypot (x , y )
241
210
theta = (np .arctan2 (y , x ) + 2 * np .pi ) % (2 * np .pi )
242
- # PolarAxes does not use the theta transforms here, but apply them for
243
- # backwards-compatibility if not being used by it.
244
- if self ._apply_theta_transforms and self ._axis is not None :
245
- theta -= self ._axis .get_theta_offset ()
246
- theta *= self ._axis .get_theta_direction ()
247
- theta %= 2 * np .pi
248
211
if self ._use_rmin and self ._axis is not None :
249
212
r += self ._axis .get_rorigin ()
250
213
r *= self ._axis .get_rsign ()
251
214
return np .column_stack ([theta , r ])
252
215
253
216
def inverted (self ):
254
217
# docstring inherited
255
- return PolarAxes .PolarTransform (
256
- self ._axis , self ._use_rmin ,
257
- apply_theta_transforms = self ._apply_theta_transforms
258
- )
218
+ return PolarAxes .PolarTransform (self ._axis , self ._use_rmin )
259
219
260
220
261
221
class ThetaFormatter (mticker .Formatter ):
@@ -895,7 +855,6 @@ def _set_lim_and_transforms(self):
895
855
# data. This one is aware of rmin
896
856
self .transProjection = self .PolarTransform (
897
857
self ,
898
- apply_theta_transforms = False ,
899
858
scale_transform = self .transScale
900
859
)
901
860
# Add dependency on rorigin.
0 commit comments