1515from matplotlib .spines import Spine
1616
1717
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-
3218class PolarTransform (mtransforms .Transform ):
3319 r"""
3420 The base polar transform.
@@ -48,8 +34,7 @@ class PolarTransform(mtransforms.Transform):
4834
4935 input_dims = output_dims = 2
5036
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 ):
5338 """
5439 Parameters
5540 ----------
@@ -64,15 +49,12 @@ def __init__(self, axis=None, use_rmin=True, *,
6449 super ().__init__ ()
6550 self ._axis = axis
6651 self ._use_rmin = use_rmin
67- self ._apply_theta_transforms = apply_theta_transforms
6852 self ._scale_transform = scale_transform
69- if apply_theta_transforms :
70- _apply_theta_transforms_warn ()
7153
7254 __str__ = mtransforms ._make_str_method (
7355 "_axis" ,
74- use_rmin = "_use_rmin" ,
75- apply_theta_transforms = "_apply_theta_transforms" )
56+ use_rmin = "_use_rmin"
57+ )
7658
7759 def _get_rorigin (self ):
7860 # Get lower r limit after being scaled by the radial scale transform
@@ -82,11 +64,6 @@ def _get_rorigin(self):
8264 def transform_non_affine (self , values ):
8365 # docstring inherited
8466 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 ()
9067 if self ._use_rmin and self ._axis is not None :
9168 r = (r - self ._get_rorigin ()) * self ._axis .get_rsign ()
9269 r = np .where (r >= 0 , r , np .nan )
@@ -148,10 +125,7 @@ def transform_path_non_affine(self, path):
148125
149126 def inverted (self ):
150127 # 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 )
155129
156130
157131class PolarAffine (mtransforms .Affine2DBase ):
@@ -209,8 +183,7 @@ class InvertedPolarTransform(mtransforms.Transform):
209183 """
210184 input_dims = output_dims = 2
211185
212- def __init__ (self , axis = None , use_rmin = True ,
213- * , apply_theta_transforms = True ):
186+ def __init__ (self , axis = None , use_rmin = True ):
214187 """
215188 Parameters
216189 ----------
@@ -225,37 +198,24 @@ def __init__(self, axis=None, use_rmin=True,
225198 super ().__init__ ()
226199 self ._axis = axis
227200 self ._use_rmin = use_rmin
228- self ._apply_theta_transforms = apply_theta_transforms
229- if apply_theta_transforms :
230- _apply_theta_transforms_warn ()
231201
232202 __str__ = mtransforms ._make_str_method (
233203 "_axis" ,
234- use_rmin = "_use_rmin" ,
235- apply_theta_transforms = "_apply_theta_transforms" )
204+ use_rmin = "_use_rmin" )
236205
237206 def transform_non_affine (self , values ):
238207 # docstring inherited
239208 x , y = values .T
240209 r = np .hypot (x , y )
241210 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
248211 if self ._use_rmin and self ._axis is not None :
249212 r += self ._axis .get_rorigin ()
250213 r *= self ._axis .get_rsign ()
251214 return np .column_stack ([theta , r ])
252215
253216 def inverted (self ):
254217 # 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 )
259219
260220
261221class ThetaFormatter (mticker .Formatter ):
@@ -895,7 +855,6 @@ def _set_lim_and_transforms(self):
895855 # data. This one is aware of rmin
896856 self .transProjection = self .PolarTransform (
897857 self ,
898- apply_theta_transforms = False ,
899858 scale_transform = self .transScale
900859 )
901860 # Add dependency on rorigin.
0 commit comments