Skip to content

Commit 91bfe28

Browse files
Deprecate xshift (X) and yshift (Y) aliases from all plotting modules (remove in v0.12.0) (#2071)
Co-authored-by: Dongdong Tian <[email protected]>
1 parent 242f92b commit 91bfe28

25 files changed

+57
-79
lines changed

examples/gallery/3d_plots/scatter3d.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
zscale=1.5,
9191
)
9292

93+
# Shift plot origin in x direction
94+
fig.shift_origin(xshift=3.1)
9395
# Add colorbar legend
94-
fig.colorbar(xshift=3.1)
96+
fig.colorbar()
9597

9698
fig.show()

pygmt/helpers/decorators.py

+23-9
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,6 @@
9797
"pen": """\
9898
pen : str
9999
Set pen attributes for lines or the outline of symbols.""",
100-
"xyshift": r"""
101-
xshift : str
102-
[**a**\|\ **c**\|\ **f**\|\ **r**\][*xshift*].
103-
Shift plot origin in x-direction.
104-
yshift : str
105-
[**a**\|\ **c**\|\ **f**\|\ **r**\][*yshift*].
106-
Shift plot origin in y-direction. Full documentation is at
107-
:gmt-docs:`gmt.html#xy-full`.
108-
""",
109100
"aspatial": r"""
110101
aspatial : bool or str
111102
[*col*\ =]\ *name*\ [,...].
@@ -577,6 +568,29 @@ def new_module(*args, **kwargs):
577568
f"Use long-form parameter '{long_alias}' instead."
578569
)
579570
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
571+
572+
# xshift (X) is deprecated since v0.8.0.
573+
if "X" in kwargs or "xshift" in kwargs:
574+
if "xshift" in kwargs:
575+
kwargs["X"] = kwargs.pop("xshift")
576+
msg = (
577+
"Parameters 'X' and 'xshift' are deprecated since v0.8.0 "
578+
"and will be removed in v0.12.0. "
579+
"Use Figure.shift_origin(xshift=...) instead."
580+
)
581+
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
582+
583+
# yshift (Y) is deprecated since v0.8.0.
584+
if "Y" in kwargs or "yshift" in kwargs:
585+
if "yshift" in kwargs:
586+
kwargs["Y"] = kwargs.pop("yshift")
587+
msg = (
588+
"Parameters 'Y' and 'yshift' are deprecated since v0.8.0. "
589+
"and will be removed in v0.12.0. "
590+
"Use Figure.shift_origin(yshift=...) instead."
591+
)
592+
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
593+
580594
return module_func(*args, **kwargs)
581595

582596
new_module.aliases = aliases

pygmt/src/basemap.py

-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
Tm="compass",
2626
U="timestamp",
2727
V="verbose",
28-
X="xshift",
29-
Y="yshift",
3028
c="panel",
3129
f="coltypes",
3230
p="perspective",
@@ -84,7 +82,6 @@ def basemap(self, **kwargs):
8482
reference and anchor points
8583
{timestamp}
8684
{verbose}
87-
{xyshift}
8885
{panel}
8986
{coltypes}
9087
{perspective}

pygmt/src/coast.py

-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
S="water",
3333
U="timestamp",
3434
V="verbose",
35-
X="xshift",
36-
Y="yshift",
3735
c="panel",
3836
p="perspective",
3937
t="transparency",
@@ -177,7 +175,6 @@ def coast(self, **kwargs):
177175
[Default is no fill]. Append **+l**\|\ **+L** to =\ *continent* to
178176
only list countries in that continent; repeat if more than one
179177
continent is requested.
180-
{xyshift}
181178
{panel}
182179
{perspective}
183180
{transparency}

pygmt/src/colorbar.py

-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
I="shading",
1919
W="scale",
2020
V="verbose",
21-
X="xshift",
22-
Y="yshift",
2321
c="panel",
2422
p="perspective",
2523
t="transparency",
@@ -100,7 +98,6 @@ def colorbar(self, **kwargs):
10098
asymmetric intensity range from *low* to *high*. [Default is no
10199
illumination].
102100
{verbose}
103-
{xyshift}
104101
{panel}
105102
{perspective}
106103
{transparency}

pygmt/src/contour.py

-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
U="timestamp",
2121
V="verbose",
2222
W="pen",
23-
X="xshift",
24-
Y="yshift",
2523
b="binary",
2624
c="panel",
2725
d="nodata",
@@ -106,7 +104,6 @@ def contour(self, data=None, x=None, y=None, z=None, **kwargs):
106104
separator for the two labels instead.
107105
{timestamp}
108106
{verbose}
109-
{xyshift}
110107
{binary}
111108
{panel}
112109
{nodata}

pygmt/src/grdcontour.py

-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
V="verbose",
2323
W="pen",
2424
l="label",
25-
X="xshift",
26-
Y="yshift",
2725
c="panel",
2826
f="coltypes",
2927
p="perspective",
@@ -85,7 +83,6 @@ def grdcontour(self, grid, **kwargs):
8583
{timestamp}
8684
{verbose}
8785
{pen}
88-
{xyshift}
8986
{panel}
9087
{coltypes}
9188
label : str

pygmt/src/grdimage.py

-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
R="region",
3232
U="timestamp",
3333
V="verbose",
34-
X="xshift",
35-
Y="yshift",
3634
n="interpolation",
3735
c="panel",
3836
f="coltypes",
@@ -156,7 +154,6 @@ def grdimage(self, grid, **kwargs):
156154
3).
157155
{region}
158156
{verbose}
159-
{xyshift}
160157
{panel}
161158
{coltypes}
162159
{interpolation}

pygmt/src/grdview.py

-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
Wf="facadepen",
3131
I="shading",
3232
V="verbose",
33-
X="xshift",
34-
Y="yshift",
3533
c="panel",
3634
f="coltypes",
3735
n="interpolation",
@@ -114,7 +112,6 @@ def grdview(self, grid, **kwargs):
114112
or just give **+d** to select the default arguments
115113
[Default is **+a**\ -45\ **+nt**\ 1\ **+m**\ 0].
116114
{verbose}
117-
{xyshift}
118115
{panel}
119116
{coltypes}
120117
{interpolation}

pygmt/src/histogram.py

-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
U="timestamp",
2525
V="verbose",
2626
W="pen",
27-
X="xshift",
28-
Y="yshift",
2927
Z="histtype",
3028
b="binary",
3129
c="panel",
@@ -124,7 +122,6 @@ def histogram(self, data, **kwargs):
124122
125123
To use weights provided as a second data column instead of pure counts,
126124
append **+w**.
127-
{xyshift}
128125
{timestamp}
129126
{verbose}
130127
{binary}

pygmt/src/image.py

-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
M="monochrome",
1515
U="timestamp",
1616
V="verbose",
17-
X="xshift",
18-
Y="yshift",
1917
c="panel",
2018
p="perspective",
2119
t="transparency",
@@ -57,7 +55,6 @@ def image(self, imagefile, **kwargs):
5755
YIQ-transformation.
5856
{timestamp}
5957
{verbose}
60-
{xyshift}
6158
{panel}
6259
{perspective}
6360
{transparency}

pygmt/src/legend.py

-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
F="box",
2222
U="timestamp",
2323
V="verbose",
24-
X="xshift",
25-
Y="yshift",
2624
c="panel",
2725
p="perspective",
2826
t="transparency",
@@ -67,7 +65,6 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
6765
1p black pen and adds a white background.
6866
{timestamp}
6967
{verbose}
70-
{xyshift}
7168
{panel}
7269
{perspective}
7370
{transparency}

pygmt/src/logo.py

-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
S="style",
1616
U="timestamp",
1717
V="verbose",
18-
X="xshift",
19-
Y="yshift",
2018
c="panel",
2119
t="transparency",
2220
)
@@ -55,7 +53,6 @@ def logo(self, **kwargs):
5553
- **u** to place the URL to the GMT site
5654
{timestamp}
5755
{verbose}
58-
{xyshift}
5956
{panel}
6057
{transparency}
6158
"""

pygmt/src/meca.py

-3
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ def data_format_code(convention, component="full"):
8181
B="frame",
8282
N="no_clip",
8383
V="verbose",
84-
X="xshift",
85-
Y="yshift",
8684
c="panel",
8785
p="perspective",
8886
t="transparency",
@@ -220,7 +218,6 @@ def meca(
220218
{region}
221219
{frame}
222220
{verbose}
223-
{xyshift}
224221
{panel}
225222
{perspective}
226223
{transparency}

pygmt/src/plot.py

-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
U="timestamp",
3535
V="verbose",
3636
W="pen",
37-
X="xshift",
38-
Y="yshift",
3937
Z="zvalue",
4038
a="aspatial",
4139
b="binary",
@@ -187,7 +185,6 @@ def plot(self, data=None, x=None, y=None, size=None, direction=None, **kwargs):
187185
{pen}
188186
{timestamp}
189187
{verbose}
190-
{xyshift}
191188
zvalue : str
192189
*value*\|\ *file*.
193190
Instead of specifying a symbol or polygon fill and outline color

pygmt/src/plot3d.py

-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
S="style",
3535
V="verbose",
3636
W="pen",
37-
X="xshift",
38-
Y="yshift",
3937
Z="zvalue",
4038
a="aspatial",
4139
b="binary",
@@ -156,7 +154,6 @@ def plot3d(
156154
{timestamp}
157155
{verbose}
158156
{pen}
159-
{xyshift}
160157
zvalue : str
161158
*value*\|\ *file*.
162159
Instead of specifying a symbol or polygon fill and outline color

pygmt/src/rose.py

-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
U="timestamp",
3434
V="verbose",
3535
W="pen",
36-
X="xshift",
37-
Y="yshift",
3836
Z="scale",
3937
b="binary",
4038
d="nodata",
@@ -193,7 +191,6 @@ def rose(self, data=None, length=None, azimuth=None, **kwargs):
193191
194192
{timestamp}
195193
{verbose}
196-
{xyshift}
197194
{binary}
198195
{panel}
199196
{nodata}

pygmt/src/solar.py

-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
U="timestamp",
1919
V="verbose",
2020
W="pen",
21-
X="xshift",
22-
Y="yshift",
2321
c="panel",
2422
p="perspective",
2523
t="transparency",
@@ -60,7 +58,6 @@ def solar(self, terminator="d", terminator_datetime=None, **kwargs):
6058
Set pen attributes for lines [Default is ``"0.25p,black,solid"``].
6159
{timestamp}
6260
{verbose}
63-
{xyshift}
6461
{panel}
6562
{perspective}
6663
{transparency}

pygmt/src/subplot.py

-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
SR="sharey",
3030
T="title",
3131
V="verbose",
32-
X="xshift",
33-
Y="yshift",
3432
)
3533
@kwargs_to_strings(Ff="sequence", Fs="sequence", M="sequence", R="sequence")
3634
def subplot(self, nrows=1, ncols=1, **kwargs):
@@ -146,7 +144,6 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
146144
``frame``), the entire figure may also have an overarching *heading*
147145
[no heading]. Font is determined by setting :gmt-term:`FONT_HEADING`.
148146
{verbose}
149-
{xyshift}
150147
"""
151148
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
152149

pygmt/src/ternary.py

-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
U="timestamp",
1717
V="verbose",
1818
W="pen",
19-
X="xshift",
20-
Y="yshift",
2119
c="panel",
2220
p="perspective",
2321
t="transparency",
@@ -66,7 +64,6 @@ def ternary(self, data, alabel=None, blabel=None, clabel=None, **kwargs):
6664
*symbol*\[\ *size*].
6765
Plot individual symbols in a ternary diagram.
6866
{pen}
69-
{xyshift}
7067
{timestamp}
7168
{verbose}
7269
{panel}

pygmt/src/text.py

-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
U="timestamp",
2929
V="verbose",
3030
W="pen",
31-
X="xshift",
32-
Y="yshift",
3331
a="aspatial",
3432
c="panel",
3533
e="find",
@@ -153,7 +151,6 @@ def text_(
153151
Do NOT clip text at map boundaries [Default is with clip].
154152
{timestamp}
155153
{verbose}
156-
{xyshift}
157154
{aspatial}
158155
{panel}
159156
{find}

pygmt/src/velo.py

-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
U="timestamp",
2727
V="verbose",
2828
W="pen",
29-
X="xshift",
30-
Y="yshift",
3129
Z="zvalue",
3230
c="panel",
3331
d="nodata",
@@ -218,7 +216,6 @@ def velo(self, data=None, **kwargs):
218216
updated from the CPT (see ``cmap``). If instead modifier **+cf** is
219217
appended then the color from the cpt file is applied to symbol fill
220218
only [Default]. Use just **+c** to set both pen and fill color.
221-
{xyshift}
222219
zvalue : str
223220
[**m**\|\ **e**\|\ **n**\|\ **u**\ ][**+e**].
224221
Select the quantity that will be used with the CPT given via ``cmap``

0 commit comments

Comments
 (0)