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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 23 additions & 9 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 3 deletions
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}

0 commit comments

Comments
 (0)