Skip to content

Commit cd04740

Browse files
authored
Merge pull request #369 from nschloe/less-test-precision
Less test precision
2 parents db8212e + 36df99c commit cd04740

File tree

80 files changed

+6253
-6265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+6253
-6265
lines changed

.github/workflows/test.yml renamed to .github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: ci
22

33
on: [push]
44

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2010-2019 Nico Schlömer
3+
Copyright (c) 2010-2020 Nico Schlömer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = "tikzplotlib"
22-
copyright = "2010-2019, Nico Schlömer"
22+
copyright = "2010-2020, Nico Schlömer"
2323
author = "Nico Schlömer"
2424

2525
# https://packaging.python.org/single_source_version/

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
long_description=open("README.md").read(),
2222
long_description_content_type="text/markdown",
2323
license=about["__license__"],
24-
python_requires=">=3",
24+
python_requires=">=3.6",
2525
classifiers=[
2626
about["__status__"],
2727
about["__license__"],

test/helpers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def print_tree(obj, indent=""):
1818

1919
for child in obj.get_children():
2020
print_tree(child, indent + " ")
21-
return
2221

2322

2423
# https://stackoverflow.com/a/845432/353337
@@ -34,7 +33,7 @@ def _unidiff_output(expected, actual):
3433
def assert_equality(plot, filename, **extra_get_tikz_code_args):
3534
plot()
3635
code = tikzplotlib.get_tikz_code(
37-
include_disclaimer=False, **extra_get_tikz_code_args
36+
include_disclaimer=False, float_format="{:.8g}", **extra_get_tikz_code_args
3837
)
3938
plt.close()
4039

@@ -47,7 +46,6 @@ def assert_equality(plot, filename, **extra_get_tikz_code_args):
4746
include_disclaimer=False, standalone=True, **extra_get_tikz_code_args
4847
)
4948
assert _compile(code) is not None
50-
return
5149

5250

5351
def _compile(code):
@@ -96,4 +94,3 @@ def compare_mpl_latex(plot):
9694
png_path = os.path.join(pdf_dirname, "test-1.png")
9795

9896
os.rename(png_path, os.path.join(directory, "test-1.png"))
99-
return

test/refresh_reference_files.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ def _main():
2424
spec.loader.exec_module(module)
2525
module.plot()
2626

27-
code = tpl.get_tikz_code(include_disclaimer=False)
27+
code = tpl.get_tikz_code(include_disclaimer=False, float_format="{:.8g}")
2828
plt.close()
2929

3030
tex_filename = filename[:-3] + "_reference.tex"
3131
with open(os.path.join(this_dir, tex_filename), "w", encoding="utf8") as f:
3232
f.write(code)
33-
return
3433

3534

3635
if __name__ == "__main__":

test/test_annotate_reference.tex

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@
33
\begin{axis}[
44
tick align=outside,
55
tick pos=left,
6-
x grid style={white!69.01960784313725!black},
6+
x grid style={white!69.019608!black},
77
xmin=-1, xmax=5,
88
xtick style={color=black},
9-
y grid style={white!69.01960784313725!black},
9+
y grid style={white!69.019608!black},
1010
ymin=-4, ymax=3,
1111
ytick style={color=black}
1212
]
1313
\addplot [semithick, blue]
1414
table {%
1515
0 1
16-
0.2 0.309016994374947
17-
0.4 -0.809016994374947
18-
0.6 -0.809016994374947
19-
0.8 0.309016994374947
16+
0.2 0.30901699
17+
0.4 -0.80901699
18+
0.6 -0.80901699
19+
0.8 0.30901699
2020
1 1
21-
1.2 0.309016994374947
22-
1.4 -0.809016994374947
23-
1.6 -0.809016994374948
24-
1.8 0.309016994374947
21+
1.2 0.30901699
22+
1.4 -0.80901699
23+
1.6 -0.80901699
24+
1.8 0.30901699
2525
2 1
26-
2.2 0.309016994374946
27-
2.4 -0.809016994374948
28-
2.6 -0.809016994374948
29-
2.8 0.309016994374947
26+
2.2 0.30901699
27+
2.4 -0.80901699
28+
2.6 -0.80901699
29+
2.8 0.30901699
3030
3 1
31-
3.2 0.309016994374948
32-
3.4 -0.809016994374949
33-
3.6 -0.809016994374948
34-
3.8 0.309016994374947
31+
3.2 0.30901699
32+
3.4 -0.80901699
33+
3.6 -0.80901699
34+
3.8 0.30901699
3535
4 1
36-
4.2 0.309016994374948
37-
4.4 -0.809016994374949
38-
4.6 -0.809016994374946
39-
4.8 0.30901699437495
36+
4.2 0.30901699
37+
4.4 -0.80901699
38+
4.6 -0.80901699
39+
4.8 0.30901699
4040
};
4141
\draw[->,draw=red] (axis cs:4.5,1.5) -- (axis cs:4,1);
4242
\draw (axis cs:4.5,1.5) node[

test/test_arrows_reference.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
\begin{tikzpicture}
22

3-
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
3+
\definecolor{color0}{rgb}{0.12156863,0.46666667,0.70588235}
44

55
\begin{axis}[
66
tick align=outside,
77
tick pos=left,
8-
x grid style={white!69.01960784313725!black},
8+
x grid style={white!69.019608!black},
99
xmin=0, xmax=8,
1010
xtick style={color=black},
11-
y grid style={white!69.01960784313725!black},
11+
y grid style={white!69.019608!black},
1212
ymin=0, ymax=7.5,
1313
ytick style={color=black}
1414
]

test/test_axvline_reference.tex

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
\begin{tikzpicture}
22

3-
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
3+
\definecolor{color0}{rgb}{0.12156863,0.46666667,0.70588235}
44

55
\begin{axis}[
66
tick align=outside,
77
tick pos=left,
8-
x grid style={white!69.01960784313725!black},
9-
xmin=-2.64601320556273, xmax=2.17933396216965,
8+
x grid style={white!69.019608!black},
9+
xmin=-2.6460132, xmax=2.179334,
1010
xtick style={color=black},
11-
y grid style={white!69.01960784313725!black},
11+
y grid style={white!69.019608!black},
1212
ymin=-1, ymax=1,
1313
ytick style={color=black}
1414
]
15-
\draw[draw=none,fill=color0] (axis cs:-2.42667924339307,0) rectangle (axis cs:-2.29074205071007,1);
16-
\draw[draw=none,fill=color0] (axis cs:-2.29074205071007,0) rectangle (axis cs:-2.15480485802706,0);
17-
\draw[draw=none,fill=color0] (axis cs:-2.15480485802706,0) rectangle (axis cs:-2.01886766534405,0);
18-
\draw[draw=none,fill=color0] (axis cs:-2.01886766534405,0) rectangle (axis cs:-1.88293047266104,0);
19-
\draw[draw=none,fill=color0] (axis cs:-1.88293047266104,0) rectangle (axis cs:-1.74699327997804,0);
20-
\draw[draw=none,fill=color0] (axis cs:-1.74699327997804,0) rectangle (axis cs:-1.61105608729503,0);
21-
\draw[draw=none,fill=color0] (axis cs:-1.61105608729503,0) rectangle (axis cs:-1.47511889461202,1);
22-
\draw[draw=none,fill=color0] (axis cs:-1.47511889461202,0) rectangle (axis cs:-1.33918170192901,0);
23-
\draw[draw=none,fill=color0] (axis cs:-1.33918170192901,0) rectangle (axis cs:-1.20324450924601,0);
24-
\draw[draw=none,fill=color0] (axis cs:-1.20324450924601,0) rectangle (axis cs:-1.067307316563,1);
25-
\draw[draw=none,fill=color0] (axis cs:-1.067307316563,0) rectangle (axis cs:-0.931370123879991,0);
26-
\draw[draw=none,fill=color0] (axis cs:-0.931370123879991,0) rectangle (axis cs:-0.795432931196984,1);
27-
\draw[draw=none,fill=color0] (axis cs:-0.795432931196984,0) rectangle (axis cs:-0.659495738513976,0);
28-
\draw[draw=none,fill=color0] (axis cs:-0.659495738513976,0) rectangle (axis cs:-0.523558545830969,1);
29-
\draw[draw=none,fill=color0] (axis cs:-0.523558545830969,0) rectangle (axis cs:-0.387621353147961,1);
30-
\draw[draw=none,fill=color0] (axis cs:-0.387621353147961,0) rectangle (axis cs:-0.251684160464954,0);
31-
\draw[draw=none,fill=color0] (axis cs:-0.251684160464954,0) rectangle (axis cs:-0.115746967781946,0);
32-
\draw[draw=none,fill=color0] (axis cs:-0.115746967781946,0) rectangle (axis cs:0.0201902249010613,0);
33-
\draw[draw=none,fill=color0] (axis cs:0.0201902249010613,0) rectangle (axis cs:0.156127417584069,0);
34-
\draw[draw=none,fill=color0] (axis cs:0.156127417584069,0) rectangle (axis cs:0.292064610267076,1);
35-
\draw[draw=none,fill=color0] (axis cs:0.292064610267076,0) rectangle (axis cs:0.428001802950084,0);
36-
\draw[draw=none,fill=color0] (axis cs:0.428001802950084,0) rectangle (axis cs:0.563938995633091,0);
37-
\draw[draw=none,fill=color0] (axis cs:0.563938995633091,0) rectangle (axis cs:0.699876188316099,0);
38-
\draw[draw=none,fill=color0] (axis cs:0.699876188316099,0) rectangle (axis cs:0.835813380999106,0);
39-
\draw[draw=none,fill=color0] (axis cs:0.835813380999106,0) rectangle (axis cs:0.971750573682114,0);
40-
\draw[draw=none,fill=color0] (axis cs:0.971750573682114,0) rectangle (axis cs:1.10768776636512,1);
41-
\draw[draw=none,fill=color0] (axis cs:1.10768776636512,0) rectangle (axis cs:1.24362495904813,0);
42-
\draw[draw=none,fill=color0] (axis cs:1.24362495904813,0) rectangle (axis cs:1.37956215173114,1);
43-
\draw[draw=none,fill=color0] (axis cs:1.37956215173114,0) rectangle (axis cs:1.51549934441414,0);
44-
\draw[draw=none,fill=color0] (axis cs:1.51549934441414,0) rectangle (axis cs:1.65143653709715,1);
15+
\draw[draw=none,fill=color0] (axis cs:-2.4266792,0) rectangle (axis cs:-2.2907421,1);
16+
\draw[draw=none,fill=color0] (axis cs:-2.2907421,0) rectangle (axis cs:-2.1548049,0);
17+
\draw[draw=none,fill=color0] (axis cs:-2.1548049,0) rectangle (axis cs:-2.0188677,0);
18+
\draw[draw=none,fill=color0] (axis cs:-2.0188677,0) rectangle (axis cs:-1.8829305,0);
19+
\draw[draw=none,fill=color0] (axis cs:-1.8829305,0) rectangle (axis cs:-1.7469933,0);
20+
\draw[draw=none,fill=color0] (axis cs:-1.7469933,0) rectangle (axis cs:-1.6110561,0);
21+
\draw[draw=none,fill=color0] (axis cs:-1.6110561,0) rectangle (axis cs:-1.4751189,1);
22+
\draw[draw=none,fill=color0] (axis cs:-1.4751189,0) rectangle (axis cs:-1.3391817,0);
23+
\draw[draw=none,fill=color0] (axis cs:-1.3391817,0) rectangle (axis cs:-1.2032445,0);
24+
\draw[draw=none,fill=color0] (axis cs:-1.2032445,0) rectangle (axis cs:-1.0673073,1);
25+
\draw[draw=none,fill=color0] (axis cs:-1.0673073,0) rectangle (axis cs:-0.93137012,0);
26+
\draw[draw=none,fill=color0] (axis cs:-0.93137012,0) rectangle (axis cs:-0.79543293,1);
27+
\draw[draw=none,fill=color0] (axis cs:-0.79543293,0) rectangle (axis cs:-0.65949574,0);
28+
\draw[draw=none,fill=color0] (axis cs:-0.65949574,0) rectangle (axis cs:-0.52355855,1);
29+
\draw[draw=none,fill=color0] (axis cs:-0.52355855,0) rectangle (axis cs:-0.38762135,1);
30+
\draw[draw=none,fill=color0] (axis cs:-0.38762135,0) rectangle (axis cs:-0.25168416,0);
31+
\draw[draw=none,fill=color0] (axis cs:-0.25168416,0) rectangle (axis cs:-0.11574697,0);
32+
\draw[draw=none,fill=color0] (axis cs:-0.11574697,0) rectangle (axis cs:0.020190225,0);
33+
\draw[draw=none,fill=color0] (axis cs:0.020190225,0) rectangle (axis cs:0.15612742,0);
34+
\draw[draw=none,fill=color0] (axis cs:0.15612742,0) rectangle (axis cs:0.29206461,1);
35+
\draw[draw=none,fill=color0] (axis cs:0.29206461,0) rectangle (axis cs:0.4280018,0);
36+
\draw[draw=none,fill=color0] (axis cs:0.4280018,0) rectangle (axis cs:0.563939,0);
37+
\draw[draw=none,fill=color0] (axis cs:0.563939,0) rectangle (axis cs:0.69987619,0);
38+
\draw[draw=none,fill=color0] (axis cs:0.69987619,0) rectangle (axis cs:0.83581338,0);
39+
\draw[draw=none,fill=color0] (axis cs:0.83581338,0) rectangle (axis cs:0.97175057,0);
40+
\draw[draw=none,fill=color0] (axis cs:0.97175057,0) rectangle (axis cs:1.1076878,1);
41+
\draw[draw=none,fill=color0] (axis cs:1.1076878,0) rectangle (axis cs:1.243625,0);
42+
\draw[draw=none,fill=color0] (axis cs:1.243625,0) rectangle (axis cs:1.3795622,1);
43+
\draw[draw=none,fill=color0] (axis cs:1.3795622,0) rectangle (axis cs:1.5154993,0);
44+
\draw[draw=none,fill=color0] (axis cs:1.5154993,0) rectangle (axis cs:1.6514365,1);
4545
\addplot [semithick, color0]
4646
table {%
4747
1.96 -1

test/test_barchart_errorbars_reference.tex

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,55 @@
33
\begin{axis}[
44
tick align=outside,
55
tick pos=left,
6-
x grid style={white!69.01960784313725!black},
6+
x grid style={white!69.019608!black},
77
xmin=-0.5125, xmax=2.5125,
88
xtick style={color=black},
9-
y grid style={white!69.01960784313725!black},
9+
y grid style={white!69.019608!black},
1010
ymin=0, ymax=5.355,
1111
ytick style={color=black}
1212
]
1313
\draw[draw=none,fill=blue] (axis cs:-0.375,0) rectangle (axis cs:-0.125,1);
1414
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
1515
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
16-
\draw[draw=none,fill=green!50.0!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
17-
\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
18-
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
16+
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
17+
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
18+
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
1919
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
2020
\draw[draw=none,fill=red] (axis cs:1.125,0) rectangle (axis cs:1.375,3);
2121
\draw[draw=none,fill=red] (axis cs:2.125,0) rectangle (axis cs:2.375,1);
22-
\path [draw=black, line width=2.0pt]
22+
\path [draw=black, line width=2pt]
2323
(axis cs:-0.25,0.9)
2424
--(axis cs:-0.25,1.1);
2525

26-
\path [draw=black, line width=2.0pt]
26+
\path [draw=black, line width=2pt]
2727
(axis cs:0.75,1.8)
2828
--(axis cs:0.75,2.2);
2929

30-
\path [draw=black, line width=2.0pt]
30+
\path [draw=black, line width=2pt]
3131
(axis cs:1.75,2.5)
3232
--(axis cs:1.75,3.5);
3333

34-
\path [draw=black, line width=2.0pt]
34+
\path [draw=black, line width=2pt]
3535
(axis cs:0,2.6)
3636
--(axis cs:0,3.4);
3737

38-
\path [draw=black, line width=2.0pt]
38+
\path [draw=black, line width=2pt]
3939
(axis cs:1,1.8)
4040
--(axis cs:1,2.2);
4141

42-
\path [draw=black, line width=2.0pt]
42+
\path [draw=black, line width=2pt]
4343
(axis cs:2,3.5)
4444
--(axis cs:2,4.5);
4545

46-
\path [draw=black, line width=2.0pt]
46+
\path [draw=black, line width=2pt]
4747
(axis cs:0.25,4.9)
4848
--(axis cs:0.25,5.1);
4949

50-
\path [draw=black, line width=2.0pt]
50+
\path [draw=black, line width=2pt]
5151
(axis cs:1.25,2.8)
5252
--(axis cs:1.25,3.2);
5353

54-
\path [draw=black, line width=2.0pt]
54+
\path [draw=black, line width=2pt]
5555
(axis cs:2.25,0.9)
5656
--(axis cs:2.25,1.1);
5757

test/test_barchart_legend_reference.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
\begin{axis}[
44
legend cell align={left},
5-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80.0!black},
5+
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black},
66
tick align=outside,
77
tick pos=left,
8-
x grid style={white!69.01960784313725!black},
8+
x grid style={white!69.019608!black},
99
xmin=-0.5125, xmax=2.5125,
1010
xtick style={color=black},
11-
y grid style={white!69.01960784313725!black},
11+
y grid style={white!69.019608!black},
1212
ymin=0, ymax=5.25,
1313
ytick style={color=black}
1414
]
@@ -18,12 +18,12 @@
1818

1919
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
2020
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
21-
\draw[draw=none,fill=green!50.0!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
22-
\addlegendimage{ybar,ybar legend,draw=none,fill=green!50.0!black};
21+
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
22+
\addlegendimage{ybar,ybar legend,draw=none,fill=green!50!black};
2323
\addlegendentry{Data 2}
2424

25-
\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
26-
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
25+
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
26+
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
2727
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
2828
\addlegendimage{ybar,ybar legend,draw=none,fill=red};
2929
\addlegendentry{Data 3}

test/test_barchart_reference.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
\begin{axis}[
44
tick align=outside,
55
tick pos=left,
6-
x grid style={white!69.01960784313725!black},
6+
x grid style={white!69.019608!black},
77
xmin=-0.5125, xmax=2.5125,
88
xtick style={color=black},
9-
y grid style={white!69.01960784313725!black},
9+
y grid style={white!69.019608!black},
1010
ymin=0, ymax=5.25,
1111
ytick style={color=black}
1212
]
1313
\draw[draw=none,fill=blue] (axis cs:-0.375,0) rectangle (axis cs:-0.125,1);
1414
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
1515
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
16-
\draw[draw=none,fill=green!50.0!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
17-
\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
18-
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
16+
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
17+
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
18+
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
1919
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
2020
\draw[draw=none,fill=red] (axis cs:1.125,0) rectangle (axis cs:1.375,3);
2121
\draw[draw=none,fill=red] (axis cs:2.125,0) rectangle (axis cs:2.375,1);

test/test_basic_sin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def plot():
88
fig = plt.figure()
9-
with plt.style.context(("ggplot")):
9+
with plt.style.context("ggplot"):
1010
t = np.arange(0.0, 2.0, 0.1)
1111
s = np.sin(2 * np.pi * t)
1212
s2 = np.cos(2 * np.pi * t)
@@ -24,7 +24,6 @@ def plot():
2424

2525
def test():
2626
assert_equality(plot, "test_basic_sin_reference.tex")
27-
return
2827

2928

3029
if __name__ == "__main__":

0 commit comments

Comments
 (0)