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

Commit7f0847c

Browse files
committed
Make _apply_theta_transforms public
1 parentb19f15e commit7f0847c

File tree

11 files changed

+44
-31
lines changed

11 files changed

+44
-31
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.

‎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

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,

‎examples/axisartist/demo_curvelinear_grid.py

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

‎examples/axisartist/demo_floating_axes.py

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

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

101101
tr=tr_rotate+tr_scale+PolarAxes.PolarTransform(
102-
_apply_theta_transforms=False)
102+
apply_theta_transforms=False)
103103

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

‎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,

‎examples/axisartist/simple_axis_pad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def setup_axes(fig, rect):
2323

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,20,
2929
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
@@ -147,8 +147,10 @@ def transform_path_non_affine(self, path):
147147

148148
definverted(self):
149149
# docstring inherited
150-
returnPolarAxes.InvertedPolarTransform(self._axis,self._use_rmin,
151-
self._apply_theta_transforms)
150+
returnPolarAxes.InvertedPolarTransform(
151+
self._axis,self._use_rmin,
152+
apply_theta_transforms=self._apply_theta_transforms
153+
)
152154

153155

154156
classPolarAffine(mtransforms.Affine2DBase):
@@ -207,7 +209,7 @@ class InvertedPolarTransform(mtransforms.Transform):
207209
input_dims=output_dims=2
208210

209211
def__init__(self,axis=None,use_rmin=True,
210-
_apply_theta_transforms=True):
212+
*,apply_theta_transforms=True):
211213
"""
212214
Parameters
213215
----------
@@ -222,14 +224,14 @@ def __init__(self, axis=None, use_rmin=True,
222224
super().__init__()
223225
self._axis=axis
224226
self._use_rmin=use_rmin
225-
self._apply_theta_transforms=_apply_theta_transforms
226-
if_apply_theta_transforms:
227+
self._apply_theta_transforms=apply_theta_transforms
228+
ifapply_theta_transforms:
227229
_apply_theta_transforms_warn()
228230

229231
__str__=mtransforms._make_str_method(
230232
"_axis",
231233
use_rmin="_use_rmin",
232-
_apply_theta_transforms="_apply_theta_transforms")
234+
apply_theta_transforms="_apply_theta_transforms")
233235

234236
deftransform_non_affine(self,xy):
235237
# docstring inherited
@@ -249,8 +251,10 @@ def transform_non_affine(self, xy):
249251

250252
definverted(self):
251253
# docstring inherited
252-
returnPolarAxes.PolarTransform(self._axis,self._use_rmin,
253-
self._apply_theta_transforms)
254+
returnPolarAxes.PolarTransform(
255+
self._axis,self._use_rmin,
256+
apply_theta_transforms=self._apply_theta_transforms
257+
)
254258

255259

256260
classThetaFormatter(mticker.Formatter):
@@ -904,7 +908,7 @@ def _set_lim_and_transforms(self):
904908
# data. This one is aware of rmin
905909
self.transProjection=self.PolarTransform(
906910
self,
907-
_apply_theta_transforms=False,
911+
apply_theta_transforms=False,
908912
scale_transform=self.transScale
909913
)
910914
# Add dependency on rorigin.

‎lib/matplotlib/tests/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def test_str_transform():
512512
PolarTransform(
513513
PolarAxes(0.125,0.1;0.775x0.8),
514514
use_rmin=True,
515-
_apply_theta_transforms=False)),
515+
apply_theta_transforms=False)),
516516
CompositeGenericTransform(
517517
CompositeGenericTransform(
518518
PolarAffine(

‎lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ def _get_xy_transform(self, renderer, s):
15081508
returnself.axes.transData
15091509
elifs=='polar':
15101510
frommatplotlib.projectionsimportPolarAxes
1511-
tr=PolarAxes.PolarTransform(_apply_theta_transforms=False)
1511+
tr=PolarAxes.PolarTransform(apply_theta_transforms=False)
15121512
trans=tr+self.axes.transData
15131513
returntrans
15141514

‎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
@@ -85,7 +85,7 @@ def test_polar_box():
8585
# PolarAxes.PolarTransform takes radian. However, we want our coordinate
8686
# system in degree
8787
tr= (Affine2D().scale(np.pi/180.,1.)+
88-
PolarAxes.PolarTransform(_apply_theta_transforms=False))
88+
PolarAxes.PolarTransform(apply_theta_transforms=False))
8989

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp