File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ def legend(
55
55
The legend specification. It can be:
56
56
57
57
- ``None`` for using the automatically generated legend specification file.
58
- - A *filename* pointing to the legend specification file.
58
+ - A string or a :class:`pathlib.PurePath` object pointing to the legend
59
+ specification file.
59
60
- A :class:`io.StringIO` object containing the legend specification.
60
61
61
62
See :gmt-docs:`legend.html` for the definition of the legend specification.
@@ -88,14 +89,12 @@ def legend(
88
89
if kwargs .get ("F" ) is None :
89
90
kwargs ["F" ] = box
90
91
91
- if spec is None :
92
- specfile = ""
93
- else :
94
- kind = data_kind (spec )
95
- if (kind == "file" and not is_nonstr_iter (spec )) or kind == "stringio" :
96
- # Is a file but not a list of files or a SrtringIO object
92
+ match data_kind (spec ):
93
+ case "vectors" : # spec is None
94
+ specfile = ""
95
+ case kind if kind == "file" and not is_nonstr_iter (spec ):
97
96
specfile = spec
98
- else :
97
+ case _ :
99
98
raise GMTInvalidInput (f"Unrecognized data type: { type (spec )} " )
100
99
101
100
with Session () as lib :
You can’t perform that action at this time.
0 commit comments