Skip to content

Commit

Permalink
Merge pull request #369 from nschloe/less-test-precision
Browse files Browse the repository at this point in the history
Less test precision
  • Loading branch information
nschloe committed Jan 10, 2020
2 parents db8212e + 36df99c commit cd04740
Show file tree
Hide file tree
Showing 80 changed files with 6,253 additions and 6,265 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: ci

on: [push]

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# -- Project information -----------------------------------------------------

project = "tikzplotlib"
copyright = "2010-2019, Nico Schlömer"
copyright = "2010-2020, Nico Schlömer"
author = "Nico Schlömer"

# https://packaging.python.org/single_source_version/
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
license=about["__license__"],
python_requires=">=3",
python_requires=">=3.6",
classifiers=[
about["__status__"],
about["__license__"],
Expand Down
5 changes: 1 addition & 4 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def print_tree(obj, indent=""):

for child in obj.get_children():
print_tree(child, indent + " ")
return


# https://stackoverflow.com/a/845432/353337
Expand All @@ -34,7 +33,7 @@ def _unidiff_output(expected, actual):
def assert_equality(plot, filename, **extra_get_tikz_code_args):
plot()
code = tikzplotlib.get_tikz_code(
include_disclaimer=False, **extra_get_tikz_code_args
include_disclaimer=False, float_format="{:.8g}", **extra_get_tikz_code_args
)
plt.close()

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


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

os.rename(png_path, os.path.join(directory, "test-1.png"))
return
3 changes: 1 addition & 2 deletions test/refresh_reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ def _main():
spec.loader.exec_module(module)
module.plot()

code = tpl.get_tikz_code(include_disclaimer=False)
code = tpl.get_tikz_code(include_disclaimer=False, float_format="{:.8g}")
plt.close()

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


if __name__ == "__main__":
Expand Down
44 changes: 22 additions & 22 deletions test/test_annotate_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
\begin{axis}[
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
x grid style={white!69.019608!black},
xmin=-1, xmax=5,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=-4, ymax=3,
ytick style={color=black}
]
\addplot [semithick, blue]
table {%
0 1
0.2 0.309016994374947
0.4 -0.809016994374947
0.6 -0.809016994374947
0.8 0.309016994374947
0.2 0.30901699
0.4 -0.80901699
0.6 -0.80901699
0.8 0.30901699
1 1
1.2 0.309016994374947
1.4 -0.809016994374947
1.6 -0.809016994374948
1.8 0.309016994374947
1.2 0.30901699
1.4 -0.80901699
1.6 -0.80901699
1.8 0.30901699
2 1
2.2 0.309016994374946
2.4 -0.809016994374948
2.6 -0.809016994374948
2.8 0.309016994374947
2.2 0.30901699
2.4 -0.80901699
2.6 -0.80901699
2.8 0.30901699
3 1
3.2 0.309016994374948
3.4 -0.809016994374949
3.6 -0.809016994374948
3.8 0.309016994374947
3.2 0.30901699
3.4 -0.80901699
3.6 -0.80901699
3.8 0.30901699
4 1
4.2 0.309016994374948
4.4 -0.809016994374949
4.6 -0.809016994374946
4.8 0.30901699437495
4.2 0.30901699
4.4 -0.80901699
4.6 -0.80901699
4.8 0.30901699
};
\draw[->,draw=red] (axis cs:4.5,1.5) -- (axis cs:4,1);
\draw (axis cs:4.5,1.5) node[
Expand Down
6 changes: 3 additions & 3 deletions test/test_arrows_reference.tex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
\begin{tikzpicture}

\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\definecolor{color0}{rgb}{0.12156863,0.46666667,0.70588235}

\begin{axis}[
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
x grid style={white!69.019608!black},
xmin=0, xmax=8,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=0, ymax=7.5,
ytick style={color=black}
]
Expand Down
68 changes: 34 additions & 34 deletions test/test_axvline_reference.tex
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
\begin{tikzpicture}

\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\definecolor{color0}{rgb}{0.12156863,0.46666667,0.70588235}

\begin{axis}[
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
xmin=-2.64601320556273, xmax=2.17933396216965,
x grid style={white!69.019608!black},
xmin=-2.6460132, xmax=2.179334,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=-1, ymax=1,
ytick style={color=black}
]
\draw[draw=none,fill=color0] (axis cs:-2.42667924339307,0) rectangle (axis cs:-2.29074205071007,1);
\draw[draw=none,fill=color0] (axis cs:-2.29074205071007,0) rectangle (axis cs:-2.15480485802706,0);
\draw[draw=none,fill=color0] (axis cs:-2.15480485802706,0) rectangle (axis cs:-2.01886766534405,0);
\draw[draw=none,fill=color0] (axis cs:-2.01886766534405,0) rectangle (axis cs:-1.88293047266104,0);
\draw[draw=none,fill=color0] (axis cs:-1.88293047266104,0) rectangle (axis cs:-1.74699327997804,0);
\draw[draw=none,fill=color0] (axis cs:-1.74699327997804,0) rectangle (axis cs:-1.61105608729503,0);
\draw[draw=none,fill=color0] (axis cs:-1.61105608729503,0) rectangle (axis cs:-1.47511889461202,1);
\draw[draw=none,fill=color0] (axis cs:-1.47511889461202,0) rectangle (axis cs:-1.33918170192901,0);
\draw[draw=none,fill=color0] (axis cs:-1.33918170192901,0) rectangle (axis cs:-1.20324450924601,0);
\draw[draw=none,fill=color0] (axis cs:-1.20324450924601,0) rectangle (axis cs:-1.067307316563,1);
\draw[draw=none,fill=color0] (axis cs:-1.067307316563,0) rectangle (axis cs:-0.931370123879991,0);
\draw[draw=none,fill=color0] (axis cs:-0.931370123879991,0) rectangle (axis cs:-0.795432931196984,1);
\draw[draw=none,fill=color0] (axis cs:-0.795432931196984,0) rectangle (axis cs:-0.659495738513976,0);
\draw[draw=none,fill=color0] (axis cs:-0.659495738513976,0) rectangle (axis cs:-0.523558545830969,1);
\draw[draw=none,fill=color0] (axis cs:-0.523558545830969,0) rectangle (axis cs:-0.387621353147961,1);
\draw[draw=none,fill=color0] (axis cs:-0.387621353147961,0) rectangle (axis cs:-0.251684160464954,0);
\draw[draw=none,fill=color0] (axis cs:-0.251684160464954,0) rectangle (axis cs:-0.115746967781946,0);
\draw[draw=none,fill=color0] (axis cs:-0.115746967781946,0) rectangle (axis cs:0.0201902249010613,0);
\draw[draw=none,fill=color0] (axis cs:0.0201902249010613,0) rectangle (axis cs:0.156127417584069,0);
\draw[draw=none,fill=color0] (axis cs:0.156127417584069,0) rectangle (axis cs:0.292064610267076,1);
\draw[draw=none,fill=color0] (axis cs:0.292064610267076,0) rectangle (axis cs:0.428001802950084,0);
\draw[draw=none,fill=color0] (axis cs:0.428001802950084,0) rectangle (axis cs:0.563938995633091,0);
\draw[draw=none,fill=color0] (axis cs:0.563938995633091,0) rectangle (axis cs:0.699876188316099,0);
\draw[draw=none,fill=color0] (axis cs:0.699876188316099,0) rectangle (axis cs:0.835813380999106,0);
\draw[draw=none,fill=color0] (axis cs:0.835813380999106,0) rectangle (axis cs:0.971750573682114,0);
\draw[draw=none,fill=color0] (axis cs:0.971750573682114,0) rectangle (axis cs:1.10768776636512,1);
\draw[draw=none,fill=color0] (axis cs:1.10768776636512,0) rectangle (axis cs:1.24362495904813,0);
\draw[draw=none,fill=color0] (axis cs:1.24362495904813,0) rectangle (axis cs:1.37956215173114,1);
\draw[draw=none,fill=color0] (axis cs:1.37956215173114,0) rectangle (axis cs:1.51549934441414,0);
\draw[draw=none,fill=color0] (axis cs:1.51549934441414,0) rectangle (axis cs:1.65143653709715,1);
\draw[draw=none,fill=color0] (axis cs:-2.4266792,0) rectangle (axis cs:-2.2907421,1);
\draw[draw=none,fill=color0] (axis cs:-2.2907421,0) rectangle (axis cs:-2.1548049,0);
\draw[draw=none,fill=color0] (axis cs:-2.1548049,0) rectangle (axis cs:-2.0188677,0);
\draw[draw=none,fill=color0] (axis cs:-2.0188677,0) rectangle (axis cs:-1.8829305,0);
\draw[draw=none,fill=color0] (axis cs:-1.8829305,0) rectangle (axis cs:-1.7469933,0);
\draw[draw=none,fill=color0] (axis cs:-1.7469933,0) rectangle (axis cs:-1.6110561,0);
\draw[draw=none,fill=color0] (axis cs:-1.6110561,0) rectangle (axis cs:-1.4751189,1);
\draw[draw=none,fill=color0] (axis cs:-1.4751189,0) rectangle (axis cs:-1.3391817,0);
\draw[draw=none,fill=color0] (axis cs:-1.3391817,0) rectangle (axis cs:-1.2032445,0);
\draw[draw=none,fill=color0] (axis cs:-1.2032445,0) rectangle (axis cs:-1.0673073,1);
\draw[draw=none,fill=color0] (axis cs:-1.0673073,0) rectangle (axis cs:-0.93137012,0);
\draw[draw=none,fill=color0] (axis cs:-0.93137012,0) rectangle (axis cs:-0.79543293,1);
\draw[draw=none,fill=color0] (axis cs:-0.79543293,0) rectangle (axis cs:-0.65949574,0);
\draw[draw=none,fill=color0] (axis cs:-0.65949574,0) rectangle (axis cs:-0.52355855,1);
\draw[draw=none,fill=color0] (axis cs:-0.52355855,0) rectangle (axis cs:-0.38762135,1);
\draw[draw=none,fill=color0] (axis cs:-0.38762135,0) rectangle (axis cs:-0.25168416,0);
\draw[draw=none,fill=color0] (axis cs:-0.25168416,0) rectangle (axis cs:-0.11574697,0);
\draw[draw=none,fill=color0] (axis cs:-0.11574697,0) rectangle (axis cs:0.020190225,0);
\draw[draw=none,fill=color0] (axis cs:0.020190225,0) rectangle (axis cs:0.15612742,0);
\draw[draw=none,fill=color0] (axis cs:0.15612742,0) rectangle (axis cs:0.29206461,1);
\draw[draw=none,fill=color0] (axis cs:0.29206461,0) rectangle (axis cs:0.4280018,0);
\draw[draw=none,fill=color0] (axis cs:0.4280018,0) rectangle (axis cs:0.563939,0);
\draw[draw=none,fill=color0] (axis cs:0.563939,0) rectangle (axis cs:0.69987619,0);
\draw[draw=none,fill=color0] (axis cs:0.69987619,0) rectangle (axis cs:0.83581338,0);
\draw[draw=none,fill=color0] (axis cs:0.83581338,0) rectangle (axis cs:0.97175057,0);
\draw[draw=none,fill=color0] (axis cs:0.97175057,0) rectangle (axis cs:1.1076878,1);
\draw[draw=none,fill=color0] (axis cs:1.1076878,0) rectangle (axis cs:1.243625,0);
\draw[draw=none,fill=color0] (axis cs:1.243625,0) rectangle (axis cs:1.3795622,1);
\draw[draw=none,fill=color0] (axis cs:1.3795622,0) rectangle (axis cs:1.5154993,0);
\draw[draw=none,fill=color0] (axis cs:1.5154993,0) rectangle (axis cs:1.6514365,1);
\addplot [semithick, color0]
table {%
1.96 -1
Expand Down
28 changes: 14 additions & 14 deletions test/test_barchart_errorbars_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,55 @@
\begin{axis}[
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
x grid style={white!69.019608!black},
xmin=-0.5125, xmax=2.5125,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=0, ymax=5.355,
ytick style={color=black}
]
\draw[draw=none,fill=blue] (axis cs:-0.375,0) rectangle (axis cs:-0.125,1);
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
\draw[draw=none,fill=green!50.0!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
\draw[draw=none,fill=red] (axis cs:1.125,0) rectangle (axis cs:1.375,3);
\draw[draw=none,fill=red] (axis cs:2.125,0) rectangle (axis cs:2.375,1);
\path [draw=black, line width=2.0pt]
\path [draw=black, line width=2pt]
(axis cs:-0.25,0.9)
--(axis cs:-0.25,1.1);

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

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

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

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

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

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

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

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

Expand Down
14 changes: 7 additions & 7 deletions test/test_barchart_legend_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

\begin{axis}[
legend cell align={left},
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80.0!black},
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black},
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
x grid style={white!69.019608!black},
xmin=-0.5125, xmax=2.5125,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=0, ymax=5.25,
ytick style={color=black}
]
Expand All @@ -18,12 +18,12 @@

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

\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
\addlegendimage{ybar,ybar legend,draw=none,fill=red};
\addlegendentry{Data 3}
Expand Down
10 changes: 5 additions & 5 deletions test/test_barchart_reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
\begin{axis}[
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
x grid style={white!69.019608!black},
xmin=-0.5125, xmax=2.5125,
xtick style={color=black},
y grid style={white!69.01960784313725!black},
y grid style={white!69.019608!black},
ymin=0, ymax=5.25,
ytick style={color=black}
]
\draw[draw=none,fill=blue] (axis cs:-0.375,0) rectangle (axis cs:-0.125,1);
\draw[draw=none,fill=blue] (axis cs:0.625,0) rectangle (axis cs:0.875,2);
\draw[draw=none,fill=blue] (axis cs:1.625,0) rectangle (axis cs:1.875,3);
\draw[draw=none,fill=green!50.0!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
\draw[draw=none,fill=green!50.0!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50.0!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=green!50!black] (axis cs:-0.125,0) rectangle (axis cs:0.125,3);
\draw[draw=none,fill=green!50!black] (axis cs:0.875,0) rectangle (axis cs:1.125,2);
\draw[draw=none,fill=green!50!black] (axis cs:1.875,0) rectangle (axis cs:2.125,4);
\draw[draw=none,fill=red] (axis cs:0.125,0) rectangle (axis cs:0.375,5);
\draw[draw=none,fill=red] (axis cs:1.125,0) rectangle (axis cs:1.375,3);
\draw[draw=none,fill=red] (axis cs:2.125,0) rectangle (axis cs:2.375,1);
Expand Down
3 changes: 1 addition & 2 deletions test/test_basic_sin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def plot():
fig = plt.figure()
with plt.style.context(("ggplot")):
with plt.style.context("ggplot"):
t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2 * np.pi * t)
s2 = np.cos(2 * np.pi * t)
Expand All @@ -24,7 +24,6 @@ def plot():

def test():
assert_equality(plot, "test_basic_sin_reference.tex")
return


if __name__ == "__main__":
Expand Down

0 comments on commit cd04740

Please sign in to comment.