Skip to content

Commit 130d0cb

Browse files
authored
**Breaking**: Figure.text: Fix typesetting of integers when mixed with floating-point values (#3493)
* Figure.text: Fix the typesetting of non-string text * Update the baseline image for test_text_nonstr_text.png
1 parent 054d148 commit 130d0cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pygmt/src/text.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def text_( # noqa: PLR0912
225225
if name == "angle":
226226
extra_arrays.append(np.atleast_1d(arg))
227227
else:
228-
extra_arrays.append(np.atleast_1d(arg).astype(str))
228+
extra_arrays.append(np.atleast_1d(np.asarray(arg, dtype=str)))
229229

230230
# If an array of transparency is given, GMT will read it from the last numerical
231231
# column per data record.
@@ -234,7 +234,7 @@ def text_( # noqa: PLR0912
234234
kwargs["t"] = True
235235

236236
# Append text to the last column. Text must be passed in as str type.
237-
text = np.atleast_1d(text).astype(str)
237+
text = np.atleast_1d(np.asarray(text, dtype=str))
238238
encoding = _check_encoding("".join(text))
239239
if encoding != "ascii":
240240
text = np.vectorize(non_ascii_to_octal, excluded="encoding")(
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: 7c07b7792d61e8094468eab34e8bba50
3-
size: 12757
2+
- md5: 41625972ee97af25965877eb78e0a673
3+
size: 12270
44
path: test_text_nonstr_text.png
55
hash: md5

0 commit comments

Comments
 (0)