@@ -21,9 +21,9 @@ def draw_line2d(data, obj):
2121 content = []
2222 addplot_options = []
2323
24- # If line is of length 0, do nothing. Otherwise, an empty \addplot table
25- # will be created, which will be interpreted as an external data source
26- # in either the file '' or '.tex'. Instead, render nothing.
24+ # If line is of length 0, do nothing. Otherwise, an empty \addplot table will be
25+ # created, which will be interpreted as an external data source in either the file
26+ # '' or '.tex'. Instead, render nothing.
2727 if len (obj .get_xdata ()) == 0 :
2828 return data , []
2929
@@ -291,7 +291,10 @@ def _table(obj, data):
291291 xdata = [date .strftime ("%Y-%m-%d %H:%M" ) for date in xdata ]
292292 xformat = "{}"
293293 col_sep = ","
294- content .append ("table [header=false,col sep=comma] {%\n " )
294+ opts = ["header=false" , "col sep=comma" ]
295+ if data ["table_row_sep" ] != "\n " :
296+ opts .append ("row sep=" + data ["table row sep" ])
297+ content .append ("table [{}] {{%\n " .format ("," .join (opts )))
295298 data ["current axes" ].axis_options .append ("date coordinates in=x" )
296299 # Replace float xmin/xmax by datetime
297300 # <https://github.com/matplotlib/matplotlib/issues/13727>.
@@ -321,12 +324,18 @@ def _table(obj, data):
321324
322325 for (x , y , is_masked ) in zip (xdata , ydata , ydata_mask ):
323326 if is_masked :
324- plot_table .append ((xformat + col_sep + "nan\n " ).format (x ))
327+ plot_table .append (
328+ (xformat + col_sep + "nan" + data ["table_row_sep" ]).format (x )
329+ )
325330 else :
326- plot_table .append ((xformat + col_sep + ff + "\n " ).format (x , y ))
331+ plot_table .append (
332+ (xformat + col_sep + ff + data ["table_row_sep" ]).format (x , y )
333+ )
327334 else :
328335 for x , y in zip (xdata , ydata ):
329- plot_table .append ((xformat + col_sep + ff + "\n " ).format (x , y ))
336+ plot_table .append (
337+ (xformat + col_sep + ff + data ["table_row_sep" ]).format (x , y )
338+ )
330339
331340 if data ["externalize tables" ]:
332341 filename , rel_filepath = files .new_filename (data , "table" , ".tsv" )
0 commit comments