Skip to content
Merged
14 changes: 4 additions & 10 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,25 +580,19 @@ def new_module(*args, **kwargs):

# xshift (X) is deprecated since v0.8.0.
if "X" in kwargs or "xshift" in kwargs:
if "xshift" in kwargs:
kwargs["X"] = kwargs.pop("xshift")
msg = (
"Parameters 'X' and 'xshift' are deprecated since v0.8.0 "
"and will be removed in v0.12.0. "
"Parameters 'X' and 'xshift' are no longer supported since v0.12.0. "
"Use Figure.shift_origin(xshift=...) instead."
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
raise GMTInvalidInput(msg)

# yshift (Y) is deprecated since v0.8.0.
if "Y" in kwargs or "yshift" in kwargs:
if "yshift" in kwargs:
kwargs["Y"] = kwargs.pop("yshift")
msg = (
"Parameters 'Y' and 'yshift' are deprecated since v0.8.0. "
"and will be removed in v0.12.0. "
"Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. "
"Use Figure.shift_origin(yshift=...) instead."
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)
raise GMTInvalidInput(msg)

return module_func(*args, **kwargs)

Expand Down
20 changes: 0 additions & 20 deletions pygmt/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,3 @@ def test_figure_set_display_invalid():
"""
with pytest.raises(GMTInvalidInput):
set_display(method="invalid")


def test_figure_deprecated_xshift_yshift():
"""
Check if deprecation of parameters X/Y/xshift/yshift work correctly if used.
"""
fig = Figure()
fig.basemap(region=[0, 1, 0, 1], projection="X1c/1c", frame=True)
with pytest.warns(expected_warning=SyntaxWarning) as record:
fig.plot(x=1, y=1, style="c3c", xshift="3c")
assert len(record) == 1 # check that only one warning was raised
with pytest.warns(expected_warning=SyntaxWarning) as record:
fig.plot(x=1, y=1, style="c3c", X="3c")
assert len(record) == 1 # check that only one warning was raised
with pytest.warns(expected_warning=SyntaxWarning) as record:
fig.plot(x=1, y=1, style="c3c", yshift="3c")
assert len(record) == 1 # check that only one warning was raised
with pytest.warns(expected_warning=SyntaxWarning) as record:
fig.plot(x=1, y=1, style="c3c", Y="3c")
assert len(record) == 1 # check that only one warning was raised