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 %(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+
1832class PolarTransform (mtransforms .Transform ):
1933 r"""
2034 The base polar transform.
@@ -34,8 +48,8 @@ class PolarTransform(mtransforms.Transform):
3448
3549 input_dims = output_dims = 2
3650
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 ):
3953 """
4054 Parameters
4155 ----------
@@ -50,13 +64,15 @@ def __init__(self, axis=None, use_rmin=True,
5064 super ().__init__ ()
5165 self ._axis = axis
5266 self ._use_rmin = use_rmin
53- self ._apply_theta_transforms = _apply_theta_transforms
67+ self ._apply_theta_transforms = apply_theta_transforms
5468 self ._scale_transform = scale_transform
69+ if apply_theta_transforms :
70+ _apply_theta_transforms_warn ()
5571
5672 __str__ = mtransforms ._make_str_method (
5773 "_axis" ,
5874 use_rmin = "_use_rmin" ,
59- _apply_theta_transforms = "_apply_theta_transforms" )
75+ apply_theta_transforms = "_apply_theta_transforms" )
6076
6177 def _get_rorigin (self ):
6278 # Get lower r limit after being scaled by the radial scale transform
@@ -133,8 +149,10 @@ def transform_path_non_affine(self, path):
133149
134150 def inverted (self ):
135151 # 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+ )
138156
139157
140158class PolarAffine (mtransforms .Affine2DBase ):
@@ -193,7 +211,7 @@ class InvertedPolarTransform(mtransforms.Transform):
193211 input_dims = output_dims = 2
194212
195213 def __init__ (self , axis = None , use_rmin = True ,
196- _apply_theta_transforms = True ):
214+ * , apply_theta_transforms = True ):
197215 """
198216 Parameters
199217 ----------
@@ -208,12 +226,14 @@ def __init__(self, axis=None, use_rmin=True,
208226 super ().__init__ ()
209227 self ._axis = axis
210228 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 ()
212232
213233 __str__ = mtransforms ._make_str_method (
214234 "_axis" ,
215235 use_rmin = "_use_rmin" ,
216- _apply_theta_transforms = "_apply_theta_transforms" )
236+ apply_theta_transforms = "_apply_theta_transforms" )
217237
218238 @_api .rename_parameter ("3.8" , "xy" , "values" )
219239 def transform_non_affine (self , values ):
@@ -234,8 +254,10 @@ def transform_non_affine(self, values):
234254
235255 def inverted (self ):
236256 # 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+ )
239261
240262
241263class ThetaFormatter (mticker .Formatter ):
@@ -879,7 +901,7 @@ def _set_lim_and_transforms(self):
879901 # data. This one is aware of rmin
880902 self .transProjection = self .PolarTransform (
881903 self ,
882- _apply_theta_transforms = False ,
904+ apply_theta_transforms = False ,
883905 scale_transform = self .transScale
884906 )
885907 # Add dependency on rorigin.
0 commit comments