42
42
w = "wrap" ,
43
43
)
44
44
@kwargs_to_strings (R = "sequence" , c = "sequence_comma" , p = "sequence" )
45
- def text_ ( # noqa: PLR0912
45
+ def text_ ( # noqa: PLR0912, PLR0915
46
46
self ,
47
47
textfiles = None ,
48
48
x = None ,
@@ -222,22 +222,25 @@ def text_( # noqa: PLR0912
222
222
elif isinstance (arg , int | float | str ):
223
223
kwargs ["F" ] += f"{ flag } { arg } "
224
224
225
- extra_arrays = []
226
225
confdict = {}
226
+ data = None
227
227
if kind == "empty" :
228
+ data = {"x" : x , "y" : y }
229
+ x , y = None , None
230
+
228
231
for arg , flag , name in array_args :
229
232
if is_nonstr_iter (arg ):
230
233
kwargs ["F" ] += flag
231
234
# angle is numeric type and font/justify are str type.
232
235
if name == "angle" :
233
- extra_arrays . append ( arg )
236
+ data [ "angle" ] = arg
234
237
else :
235
- extra_arrays . append ( np .asarray (arg , dtype = np .str_ ) )
238
+ data [ name ] = np .asarray (arg , dtype = np .str_ )
236
239
237
240
# If an array of transparency is given, GMT will read it from the last numerical
238
241
# column per data record.
239
242
if is_nonstr_iter (kwargs .get ("t" )):
240
- extra_arrays . append ( kwargs ["t" ])
243
+ data [ "transparency" ] = kwargs ["t" ]
241
244
kwargs ["t" ] = True
242
245
243
246
# Append text to the last column. Text must be passed in as str type.
@@ -247,7 +250,7 @@ def text_( # noqa: PLR0912
247
250
text , encoding = encoding
248
251
)
249
252
confdict ["PS_CHAR_ENCODING" ] = encoding
250
- extra_arrays . append ( text )
253
+ data [ " text" ] = text
251
254
else :
252
255
if isinstance (position , str ):
253
256
kwargs ["F" ] += f"+c{ position } +t{ text } "
@@ -260,10 +263,9 @@ def text_( # noqa: PLR0912
260
263
with Session () as lib :
261
264
with lib .virtualfile_in (
262
265
check_kind = "vector" ,
263
- data = textfiles ,
266
+ data = textfiles or data ,
264
267
x = x ,
265
268
y = y ,
266
- extra_arrays = extra_arrays ,
267
269
required_data = required_data ,
268
270
) as vintbl :
269
271
lib .call_module (
0 commit comments