Skip to content

Commit 95fa173

Browse files
committed
Fix the check_data_input_order decorator
1 parent 7b2ff17 commit 95fa173

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pygmt/helpers/decorators.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from inspect import Parameter, signature
1212

1313
import numpy as np
14+
import pygmt
1415
from pygmt.exceptions import GMTInvalidInput
1516
from pygmt.helpers.utils import is_nonstr_iter
1617

@@ -857,7 +858,14 @@ def new_module(*args, **kwargs):
857858
New module instance that raises a warning if positional arguments
858859
are passed.
859860
"""
860-
if len(args) > 0: # positional arguments are used
861+
# plotting function always has the "self" parameter
862+
if len(args) > 1 and isinstance(args[0], pygmt.Figure):
863+
plotting_func = 1
864+
else:
865+
plotting_func = 0
866+
867+
if len(args) > 1 + plotting_func:
868+
# more than one positional arguments are used
861869
msg = (
862870
"The function parameters has been re-ordered as 'data, x, y, [z]' "
863871
f"since {deprecate_version} but you're passing positional arguments. "

0 commit comments

Comments
 (0)