Skip to content

Figure.wiggle: Reorder input parameter to 'data, x, y, z' #1548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 2, 2021
10 changes: 9 additions & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,15 @@ def new_module(*args, **kwargs):
New module instance that raises a warning if positional arguments
are passed.
"""
if len(args) > 0: # positional arguments are used
# Plotting functions always have a "self" parameter
# which is a pygmt.Figure instance that has a "savefig" method
if len(args) > 1 and hasattr(args[0], "savefig"):
plotting_func = 1
else:
plotting_func = 0

if len(args) > 1 + plotting_func:
# more than one positional arguments are used
msg = (
"The function parameters has been re-ordered as 'data, x, y, [z]' "
f"since {deprecate_version} but you're passing positional arguments. "
Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/wiggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pygmt.clib import Session
from pygmt.helpers import (
build_arg_string,
check_data_input_order,
deprecate_parameter,
fmt_docstring,
kwargs_to_strings,
Expand All @@ -13,6 +14,7 @@

@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.5.0", remove_version="v0.7.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
B="frame",
D="position",
Expand All @@ -39,7 +41,7 @@
w="wrap",
)
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
def wiggle(self, x=None, y=None, z=None, data=None, **kwargs):
def wiggle(self, data=None, x=None, y=None, z=None, **kwargs):
r"""
Plot z=f(x,y) anomalies along tracks.

Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_wiggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def test_wiggle_deprecate_columns_to_incols():
fig = Figure()
with pytest.warns(expected_warning=FutureWarning) as record:
fig.wiggle(
data,
region=[-4, 4, -1, 1],
projection="X8c",
data=data,
columns=[1, 0, 2],
scale="0.5c",
color=["red+p", "gray+n"],
Expand Down