Skip to content

Commit 6c37041

Browse files
authored
_to_string: Fix the bug when a 2-D sequence is passed (#4032)
1 parent d998e7a commit 6c37041

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pygmt/alias.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ def _to_string(
106106
107107
>>> _to_string(["xaf", "yaf", "WSen"])
108108
['xaf', 'yaf', 'WSen']
109+
110+
>>> _to_string([[1, 2], [3, 4]], separator="/", ndim=2)
111+
['1/2', '3/4']
109112
"""
110113
# None and False are converted to None.
111114
if value is None or value is False:
@@ -132,7 +135,7 @@ def _to_string(
132135
# Join the sequence of values with the separator.
133136
# "prefix" and "mapping" are ignored. We can enable them when needed.
134137
_value = sequence_join(value, separator=separator, size=size, ndim=ndim, name=name)
135-
return f"{prefix}{_value}"
138+
return _value if is_nonstr_iter(_value) else f"{prefix}{_value}"
136139

137140

138141
class Alias:

0 commit comments

Comments
 (0)