Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb07f96

Browse files
committed
Remove apply_theta_transforms argument
1 parent759765c commitbb07f96

File tree

12 files changed

+28
-65
lines changed

12 files changed

+28
-65
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``apply_theta_transforms`` option in ``PolarTransform``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Applying theta transforms in `~matplotlib.projections.polar.PolarTransform` and
5+
`~matplotlib.projections.polar.InvertedPolarTransform` has been removed, and
6+
the ``apply_theta_transforms`` keyword argument removed from both classes.
7+
8+
If you need to retain the behaviour where theta values
9+
are transformed, chain the ``PolarTransform`` with a `~matplotlib.transforms.Affine2D`
10+
transform that performs the theta shift and/or sign shift.

‎galleries/examples/axisartist/demo_axis_direction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setup_axes(fig, rect):
2222
grid_helper=GridHelperCurveLinear(
2323
(
2424
Affine2D().scale(np.pi/180.,1.)+
25-
PolarAxes.PolarTransform(apply_theta_transforms=False)
25+
PolarAxes.PolarTransform()
2626
),
2727
extreme_finder=angle_helper.ExtremeFinderCycle(
2828
20,20,

‎galleries/examples/axisartist/demo_curvelinear_grid.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def curvelinear_test2(fig):
5454

5555
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
5656
# system in degree
57-
tr=Affine2D().scale(np.pi/180,1)+PolarAxes.PolarTransform(
58-
apply_theta_transforms=False)
57+
tr=Affine2D().scale(np.pi/180,1)+PolarAxes.PolarTransform()
5958
# Polar projection, which involves cycle, and also has limits in
6059
# its coordinates, needs a special method to find the extremes
6160
# (min, max of the coordinate within the view).

‎galleries/examples/axisartist/demo_floating_axes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def setup_axes2(fig, rect):
5454
With custom locator and formatter.
5555
Note that the extreme values are swapped.
5656
"""
57-
tr=PolarAxes.PolarTransform(apply_theta_transforms=False)
57+
tr=PolarAxes.PolarTransform()
5858

5959
pi=np.pi
6060
angle_ticks= [(0,r"$0$"),
@@ -99,8 +99,7 @@ def setup_axes3(fig, rect):
9999
# scale degree to radians
100100
tr_scale=Affine2D().scale(np.pi/180.,1.)
101101

102-
tr=tr_rotate+tr_scale+PolarAxes.PolarTransform(
103-
apply_theta_transforms=False)
102+
tr=tr_rotate+tr_scale+PolarAxes.PolarTransform()
104103

105104
grid_locator1=angle_helper.LocatorHMS(4)
106105
tick_formatter1=angle_helper.FormatterHMS()

‎galleries/examples/axisartist/demo_floating_axis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
defcurvelinear_test2(fig):
2323
"""Polar projection, but in a rectangular box."""
2424
# see demo_curvelinear_grid.py for details
25-
tr=Affine2D().scale(np.pi/180.,1.)+PolarAxes.PolarTransform(
26-
apply_theta_transforms=False)
25+
tr=Affine2D().scale(np.pi/180.,1.)+PolarAxes.PolarTransform()
2726

2827
extreme_finder=angle_helper.ExtremeFinderCycle(20,
2928
20,

‎galleries/examples/axisartist/simple_axis_pad.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ def setup_axes(fig, rect):
2121
"""Polar projection, but in a rectangular box."""
2222

2323
# see demo_curvelinear_grid.py for details
24-
tr=Affine2D().scale(np.pi/180.,1.)+PolarAxes.PolarTransform(
25-
apply_theta_transforms=False)
24+
tr=Affine2D().scale(np.pi/180.,1.)+PolarAxes.PolarTransform()
2625

2726
extreme_finder=angle_helper.ExtremeFinderCycle(20,20,
2827
lon_cycle=360,

‎lib/matplotlib/projections/polar.py

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@
1515
frommatplotlib.spinesimportSpine
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-
3218
classPolarTransform(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-
ifapply_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
deftransform_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-
ifself._apply_theta_transformsandself._axisisnotNone:
88-
theta*=self._axis.get_theta_direction()
89-
theta+=self._axis.get_theta_offset()
9067
ifself._use_rminandself._axisisnotNone:
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
definverted(self):
150127
# docstring inherited
151-
returnPolarAxes.InvertedPolarTransform(
152-
self._axis,self._use_rmin,
153-
apply_theta_transforms=self._apply_theta_transforms
154-
)
128+
returnPolarAxes.InvertedPolarTransform(self._axis,self._use_rmin)
155129

156130

157131
classPolarAffine(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,26 +198,16 @@ 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-
ifapply_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
deftransform_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-
ifself._apply_theta_transformsandself._axisisnotNone:
245-
theta-=self._axis.get_theta_offset()
246-
theta*=self._axis.get_theta_direction()
247-
theta%=2*np.pi
248211
ifself._use_rminandself._axisisnotNone:
249212
r+=self._axis.get_rorigin()
250213
r*=self._axis.get_rsign()
@@ -254,7 +217,6 @@ def inverted(self):
254217
# docstring inherited
255218
returnPolarAxes.PolarTransform(
256219
self._axis,self._use_rmin,
257-
apply_theta_transforms=self._apply_theta_transforms
258220
)
259221

260222

@@ -895,7 +857,6 @@ def _set_lim_and_transforms(self):
895857
# data. This one is aware of rmin
896858
self.transProjection=self.PolarTransform(
897859
self,
898-
apply_theta_transforms=False,
899860
scale_transform=self.transScale
900861
)
901862
# Add dependency on rorigin.

‎lib/matplotlib/projections/polar.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class PolarTransform(mtransforms.Transform):
1818
axis:PolarAxes|None= ...,
1919
use_rmin:bool= ...,
2020
*,
21-
apply_theta_transforms:bool= ...,
2221
scale_transform:mtransforms.Transform|None= ...,
2322
)->None: ...
2423
definverted(self)->InvertedPolarTransform: ...
@@ -35,8 +34,6 @@ class InvertedPolarTransform(mtransforms.Transform):
3534
self,
3635
axis:PolarAxes|None= ...,
3736
use_rmin:bool= ...,
38-
*,
39-
apply_theta_transforms:bool= ...,
4037
)->None: ...
4138
definverted(self)->PolarTransform: ...
4239

‎lib/matplotlib/tests/test_transforms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,7 @@ def test_str_transform():
891891
Affine2D().scale(1.0))),
892892
PolarTransform(
893893
PolarAxes(0.125,0.1;0.775x0.8),
894-
use_rmin=True,
895-
apply_theta_transforms=False)),
894+
use_rmin=True)),
896895
CompositeGenericTransform(
897896
CompositeGenericTransform(
898897
PolarAffine(

‎lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ def _get_xy_transform(self, renderer, coords):
15531553
returnself.axes.transData
15541554
elifcoords=='polar':
15551555
frommatplotlib.projectionsimportPolarAxes
1556-
tr=PolarAxes.PolarTransform(apply_theta_transforms=False)
1556+
tr=PolarAxes.PolarTransform()
15571557
trans=tr+self.axes.transData
15581558
returntrans
15591559

‎lib/mpl_toolkits/axisartist/tests/test_floating_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_curvelinear3():
2626
fig=plt.figure(figsize=(5,5))
2727

2828
tr= (mtransforms.Affine2D().scale(np.pi/180,1)+
29-
mprojections.PolarAxes.PolarTransform(apply_theta_transforms=False))
29+
mprojections.PolarAxes.PolarTransform())
3030
grid_helper=GridHelperCurveLinear(
3131
tr,
3232
extremes=(0,360,10,3),
@@ -75,7 +75,7 @@ def test_curvelinear4():
7575
fig=plt.figure(figsize=(5,5))
7676

7777
tr= (mtransforms.Affine2D().scale(np.pi/180,1)+
78-
mprojections.PolarAxes.PolarTransform(apply_theta_transforms=False))
78+
mprojections.PolarAxes.PolarTransform())
7979
grid_helper=GridHelperCurveLinear(
8080
tr,
8181
extremes=(120,30,10,0),

‎lib/mpl_toolkits/axisartist/tests/test_grid_helper_curvelinear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_polar_box():
8383
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
8484
# system in degree
8585
tr= (Affine2D().scale(np.pi/180.,1.)+
86-
PolarAxes.PolarTransform(apply_theta_transforms=False))
86+
PolarAxes.PolarTransform())
8787

8888
# polar projection, which involves cycle, and also has limits in
8989
# its coordinates, needs a special method to find the extremes
@@ -146,7 +146,7 @@ def test_axis_direction():
146146
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
147147
# system in degree
148148
tr= (Affine2D().scale(np.pi/180.,1.)+
149-
PolarAxes.PolarTransform(apply_theta_transforms=False))
149+
PolarAxes.PolarTransform())
150150

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp