Skip to content

Commit e98f74e

Browse files
committed
Further simplify Figure.legend
1 parent dc5ad22 commit e98f74e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pygmt/src/legend.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
7676
kwargs["F"] = box
7777

7878
match data_kind(spec):
79-
case "none":
80-
specfile = ""
81-
case kind if kind == "file" and not is_nonstr_iter(spec):
82-
specfile = spec
79+
case "file":
80+
if is_nonstr_iter(spec):
81+
raise GMTInvalidInput("Only one legend specification file is allowed.")
82+
case "none": # Use the auto-generated legend specification file.
83+
pass
8384
case _:
8485
raise GMTInvalidInput(f"Unrecognized data type: {type(spec)}")
8586

8687
with Session() as lib:
87-
lib.call_module(module="legend", args=build_arg_list(kwargs, infile=specfile))
88+
lib.call_module(module="legend", args=build_arg_list(kwargs, infile=spec))

0 commit comments

Comments
 (0)