Skip to content

_to_string: Fix the bug when a 2-D sequence is passed #4032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pygmt/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def _to_string(

>>> _to_string(["xaf", "yaf", "WSen"])
['xaf', 'yaf', 'WSen']

>>> _to_string([[1, 2], [3, 4]], separator="/", ndim=2)
['1/2', '3/4']
"""
# None and False are converted to None.
if value is None or value is False:
Expand All @@ -132,7 +135,7 @@ def _to_string(
# Join the sequence of values with the separator.
# "prefix" and "mapping" are ignored. We can enable them when needed.
_value = sequence_join(value, separator=separator, size=size, ndim=ndim, name=name)
return f"{prefix}{_value}"
return _value if is_nonstr_iter(_value) else f"{prefix}{_value}"


class Alias:
Expand Down
Loading