Skip to content

Commit 4406b3b

Browse files
authored
Merge pull request #338 from fsgeek/table-row-sep
Issue #298; "table_row_sep" option was not working properly; the sepa…
2 parents aee7a4f + 0d3ac68 commit 4406b3b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

test/test_basic_sin_reference.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ytick style={color=white!33.33333333333333!black}
2424
]
2525
\addplot [semithick, color0, mark=*, mark size=3, mark options={solid}]
26-
table {%
26+
table [row sep=\\] {%
2727
0 0\\
2828
0.1 0.587785252292473\\
2929
0.2 0.951056516295154\\
@@ -47,7 +47,7 @@
4747
};
4848
\addlegendentry{sin}
4949
\addplot [very thick, color1, opacity=0.3, mark=*, mark size=3, mark options={solid}]
50-
table {%
50+
table [row sep=\\] {%
5151
0 1\\
5252
0.1 0.809016994374947\\
5353
0.2 0.309016994374947\\

tikzplotlib/line2d.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,6 @@ def _table(obj, data):
303303
xformat = "{}"
304304
col_sep = ","
305305
opts = ["header=false", "col sep=comma"]
306-
if data["table_row_sep"] != "\n":
307-
opts.append("row sep=" + data["table row sep"])
308-
content.append("table [{}] {{%\n".format(",".join(opts)))
309306
data["current axes"].axis_options.append("date coordinates in=x")
310307
# Replace float xmin/xmax by datetime
311308
# <https://github.com/matplotlib/matplotlib/issues/13727>.
@@ -322,8 +319,16 @@ def _table(obj, data):
322319
)
323320
)
324321
else:
322+
opts = []
325323
xformat = ff
326324
col_sep = " "
325+
326+
if data["table_row_sep"] != "\n":
327+
# don't want the \n in the table definition, just in the data (below)
328+
opts.append("row sep=" + data["table_row_sep"].strip())
329+
if len(opts) > 0:
330+
content.append("table [{}] {{%\n".format(",".join(opts)))
331+
else:
327332
content.append("table {%\n")
328333

329334
plot_table = []

0 commit comments

Comments
 (0)