5050 w = "wrap" ,
5151)
5252@kwargs_to_strings (R = "sequence" , c = "sequence_comma" , i = "sequence_comma" , p = "sequence" )
53- def plot (
53+ def plot ( # noqa: PLR0912
5454 self ,
5555 data = None ,
5656 x = None ,
@@ -232,34 +232,37 @@ def plot(
232232 kwargs = self ._preprocess (** kwargs )
233233
234234 kind = data_kind (data )
235- extra_arrays = []
236- if kind == "empty " : # Add more columns for vectors input
235+ if kind == "empty" : # Data is given via a series of vectors.
236+ data = { "x " : x , "y" : y }
237237 # Parameters for vector styles
238238 if (
239239 isinstance (kwargs .get ("S" ), str )
240240 and len (kwargs ["S" ]) >= 1
241241 and kwargs ["S" ][0 ] in "vV"
242242 and is_nonstr_iter (direction )
243243 ):
244- extra_arrays . extend ( direction )
244+ data . update ({ "x2" : direction [ 0 ], "y2" : direction [ 1 ]} )
245245 # Fill
246246 if is_nonstr_iter (kwargs .get ("G" )):
247- extra_arrays . append ( kwargs . get ( "G" ))
247+ data [ "fill" ] = kwargs [ "G" ]
248248 del kwargs ["G" ]
249249 # Size
250250 if is_nonstr_iter (size ):
251- extra_arrays . append ( size )
251+ data [ " size" ] = size
252252 # Intensity and transparency
253- for flag in ["I" , "t " ]:
253+ for flag , name in ["I" , "intensity" ], [ "t" , "transparency " ]:
254254 if is_nonstr_iter (kwargs .get (flag )):
255- extra_arrays . append ( kwargs . get ( flag ))
255+ data [ name ] = kwargs [ flag ]
256256 kwargs [flag ] = ""
257257 # Symbol must be at the last column
258258 if is_nonstr_iter (symbol ):
259259 if "S" not in kwargs :
260260 kwargs ["S" ] = True
261- extra_arrays . append ( symbol )
261+ data [ " symbol" ] = symbol
262262 else :
263+ if any (v is not None for v in (x , y )):
264+ msg = "Too much data. Use either data or x/y/z."
265+ raise GMTInvalidInput (msg )
263266 for name , value in [
264267 ("direction" , direction ),
265268 ("fill" , kwargs .get ("G" )),
@@ -277,7 +280,5 @@ def plot(
277280 kwargs ["S" ] = "s0.2c"
278281
279282 with Session () as lib :
280- with lib .virtualfile_in (
281- check_kind = "vector" , data = data , x = x , y = y , extra_arrays = extra_arrays
282- ) as vintbl :
283+ with lib .virtualfile_in (check_kind = "vector" , data = data ) as vintbl :
283284 lib .call_module (module = "plot" , args = build_arg_list (kwargs , infile = vintbl ))
0 commit comments