Skip to content

Commit

Permalink
Fix the argument string passed in inset and subplot
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Mar 21, 2024
1 parent a2fc88f commit b52469f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 4 additions & 3 deletions pygmt/src/inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ def inset(self, **kwargs):
kwargs = self._preprocess(**kwargs)
with Session() as lib:
try:
lib.call_module(module="inset", args=f"begin {build_arg_list(kwargs)}")
lib.call_module(module="inset", args=["begin", *build_arg_list(kwargs)])
yield
finally:
v_arg = build_arg_list({"V": kwargs.get("V")})
lib.call_module(module="inset", args=f"end {v_arg}".strip())
lib.call_module(
module="inset", args=["end", *build_arg_list({"V": kwargs.get("V")})]
)
16 changes: 10 additions & 6 deletions pygmt/src/subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,16 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
# See https://github.com/GenericMappingTools/pygmt/issues/2426.
try:
with Session() as lib:
arg_str = " ".join(["begin", f"{nrows}x{ncols}", build_arg_list(kwargs)])
lib.call_module(module="subplot", args=arg_str)
lib.call_module(
module="subplot",
args=["begin", f"{nrows}x{ncols}", *build_arg_list(kwargs)],
)
yield
finally:
with Session() as lib:
v_arg = build_arg_list({"V": kwargs.get("V")})
lib.call_module(module="subplot", args=f"end {v_arg}")
lib.call_module(
module="subplot", args=["end", *build_arg_list({"V": kwargs.get("V")})]
)


@fmt_docstring
Expand Down Expand Up @@ -224,6 +227,7 @@ def set_panel(self, panel=None, **kwargs):
kwargs = self._preprocess(**kwargs)

with Session() as lib:
arg_str = " ".join(["set", f"{panel}", build_arg_list(kwargs)])
lib.call_module(module="subplot", args=arg_str)
lib.call_module(
module="subplot", args=["set", str(panel), *build_arg_list(kwargs)]
)
yield

0 comments on commit b52469f

Please sign in to comment.