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

Commitc1b80c5

Browse files
committed
Make _apply_theta_transforms public
1 parent03190e6 commitc1b80c5

File tree

10 files changed

+43
-30
lines changed

10 files changed

+43
-30
lines changed

‎doc/api/next_api_changes/deprecations/24834-DS.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ Applying theta transforms in ``PolarTransform``
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
Applying theta transforms in `~matplotlib.projections.polar.PolarTransform`
44
and `~matplotlib.projections.polar.InvertedPolarTransform`
5-
is deprecated. This is currently the default behaviour, so to prevent
6-
a warning, manually pass ``_apply_theta_transforms=False``, and
7-
apply any theta shift before passing points to this transform.
5+
is deprecated, and will be removed in a future version of Matplotlib. This
6+
is currently the default behaviour when these transforms are used externally,
7+
but only takes affect when:
8+
9+
- An axis is associated with the transform.
10+
- The axis has a non-zero theta offset or has theta values increasing in
11+
a clockwise direction.
12+
13+
To silence this warning and adopt future behaviour,
14+
set ``apply_theta_transforms=False``. If you need to retain the behaviour
15+
where theta values are transformed, chain the ``PolarTransform`` with
16+
another transform that performs the theta shift and/or sign shift.

‎galleries/examples/axisartist/demo_curvelinear_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def curvelinear_test2(fig):
5555
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
5656
# system in degree
5757
tr=Affine2D().scale(np.pi/180,1)+PolarAxes.PolarTransform(
58-
_apply_theta_transforms=False)
58+
apply_theta_transforms=False)
5959
# Polar projection, which involves cycle, and also has limits in
6060
# its coordinates, needs a special method to find the extremes
6161
# (min, max of the coordinate within the view).

‎galleries/examples/axisartist/demo_floating_axes.py

Lines changed: 2 additions & 2 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(apply_theta_transforms=False)
5858

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

102102
tr=tr_rotate+tr_scale+PolarAxes.PolarTransform(
103-
_apply_theta_transforms=False)
103+
apply_theta_transforms=False)
104104

105105
grid_locator1=angle_helper.LocatorHMS(4)
106106
tick_formatter1=angle_helper.FormatterHMS()

‎galleries/examples/axisartist/demo_floating_axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def curvelinear_test2(fig):
2323
"""Polar projection, but in a rectangular box."""
2424
# see demo_curvelinear_grid.py for details
2525
tr=Affine2D().scale(np.pi/180.,1.)+PolarAxes.PolarTransform(
26-
_apply_theta_transforms=False)
26+
apply_theta_transforms=False)
2727

2828
extreme_finder=angle_helper.ExtremeFinderCycle(20,
2929
20,

‎galleries/examples/axisartist/simple_axis_pad.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

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

2727
extreme_finder=angle_helper.ExtremeFinderCycle(20,20,
2828
lon_cycle=360,

‎lib/matplotlib/projections/polar.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def _apply_theta_transforms_warn():
1919
_api.warn_deprecated(
2020
"3.7",
2121
message=(
22-
"Passing `_apply_theta_transforms=True` (the default) "
22+
"Passing `apply_theta_transforms=True` (the default) "
2323
"is deprecated. Support for this will be removed in "
2424
"Matplotlib %(removal)s. To prevent this warning, "
25-
"set `_apply_theta_transforms=False`, and make sure to "
25+
"set `apply_theta_transforms=False`, and make sure to "
2626
"shift theta values before being passed to this transform."
2727
)
2828
)
@@ -47,8 +47,8 @@ class PolarTransform(mtransforms.Transform):
4747

4848
input_dims=output_dims=2
4949

50-
def__init__(self,axis=None,use_rmin=True,
51-
_apply_theta_transforms=True,*,scale_transform=None):
50+
def__init__(self,axis=None,use_rmin=True,*,
51+
apply_theta_transforms=True,scale_transform=None):
5252
"""
5353
Parameters
5454
----------
@@ -63,15 +63,15 @@ def __init__(self, axis=None, use_rmin=True,
6363
super().__init__()
6464
self._axis=axis
6565
self._use_rmin=use_rmin
66-
self._apply_theta_transforms=_apply_theta_transforms
66+
self._apply_theta_transforms=apply_theta_transforms
6767
self._scale_transform=scale_transform
68-
if_apply_theta_transforms:
68+
ifapply_theta_transforms:
6969
_apply_theta_transforms_warn()
7070

7171
__str__=mtransforms._make_str_method(
7272
"_axis",
7373
use_rmin="_use_rmin",
74-
_apply_theta_transforms="_apply_theta_transforms")
74+
apply_theta_transforms="_apply_theta_transforms")
7575

7676
def_get_rorigin(self):
7777
# Get lower r limit after being scaled by the radial scale transform
@@ -148,8 +148,10 @@ def transform_path_non_affine(self, path):
148148

149149
definverted(self):
150150
# docstring inherited
151-
returnPolarAxes.InvertedPolarTransform(self._axis,self._use_rmin,
152-
self._apply_theta_transforms)
151+
returnPolarAxes.InvertedPolarTransform(
152+
self._axis,self._use_rmin,
153+
apply_theta_transforms=self._apply_theta_transforms
154+
)
153155

154156

155157
classPolarAffine(mtransforms.Affine2DBase):
@@ -208,7 +210,7 @@ class InvertedPolarTransform(mtransforms.Transform):
208210
input_dims=output_dims=2
209211

210212
def__init__(self,axis=None,use_rmin=True,
211-
_apply_theta_transforms=True):
213+
*,apply_theta_transforms=True):
212214
"""
213215
Parameters
214216
----------
@@ -223,14 +225,14 @@ def __init__(self, axis=None, use_rmin=True,
223225
super().__init__()
224226
self._axis=axis
225227
self._use_rmin=use_rmin
226-
self._apply_theta_transforms=_apply_theta_transforms
227-
if_apply_theta_transforms:
228+
self._apply_theta_transforms=apply_theta_transforms
229+
ifapply_theta_transforms:
228230
_apply_theta_transforms_warn()
229231

230232
__str__=mtransforms._make_str_method(
231233
"_axis",
232234
use_rmin="_use_rmin",
233-
_apply_theta_transforms="_apply_theta_transforms")
235+
apply_theta_transforms="_apply_theta_transforms")
234236

235237
@_api.rename_parameter("3.8","xy","values")
236238
deftransform_non_affine(self,values):
@@ -251,8 +253,10 @@ def transform_non_affine(self, values):
251253

252254
definverted(self):
253255
# docstring inherited
254-
returnPolarAxes.PolarTransform(self._axis,self._use_rmin,
255-
self._apply_theta_transforms)
256+
returnPolarAxes.PolarTransform(
257+
self._axis,self._use_rmin,
258+
apply_theta_transforms=self._apply_theta_transforms
259+
)
256260

257261

258262
classThetaFormatter(mticker.Formatter):
@@ -896,7 +900,7 @@ def _set_lim_and_transforms(self):
896900
# data. This one is aware of rmin
897901
self.transProjection=self.PolarTransform(
898902
self,
899-
_apply_theta_transforms=False,
903+
apply_theta_transforms=False,
900904
scale_transform=self.transScale
901905
)
902906
# Add dependency on rorigin.

‎lib/matplotlib/tests/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def test_str_transform():
859859
PolarTransform(
860860
PolarAxes(0.125,0.1;0.775x0.8),
861861
use_rmin=True,
862-
_apply_theta_transforms=False)),
862+
apply_theta_transforms=False)),
863863
CompositeGenericTransform(
864864
CompositeGenericTransform(
865865
PolarAffine(

‎lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ def _get_xy_transform(self, renderer, coords):
14971497
returnself.axes.transData
14981498
elifcoords=='polar':
14991499
frommatplotlib.projectionsimportPolarAxes
1500-
tr=PolarAxes.PolarTransform(_apply_theta_transforms=False)
1500+
tr=PolarAxes.PolarTransform(apply_theta_transforms=False)
15011501
trans=tr+self.axes.transData
15021502
returntrans
15031503

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

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

2626
tr= (mtransforms.Affine2D().scale(np.pi/180,1)+
27-
mprojections.PolarAxes.PolarTransform(_apply_theta_transforms=False))
27+
mprojections.PolarAxes.PolarTransform(apply_theta_transforms=False))
2828
grid_helper=GridHelperCurveLinear(
2929
tr,
3030
extremes=(0,360,10,3),
@@ -73,7 +73,7 @@ def test_curvelinear4():
7373
fig=plt.figure(figsize=(5,5))
7474

7575
tr= (mtransforms.Affine2D().scale(np.pi/180,1)+
76-
mprojections.PolarAxes.PolarTransform(_apply_theta_transforms=False))
76+
mprojections.PolarAxes.PolarTransform(apply_theta_transforms=False))
7777
grid_helper=GridHelperCurveLinear(
7878
tr,
7979
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(apply_theta_transforms=False))
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(apply_theta_transforms=False))
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