Skip to content

Commit 9facdf7

Browse files
committed
added test
1 parent c1333bd commit 9facdf7

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

test/test_steps.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import matplotlib.pyplot as plt
2+
3+
4+
def plot():
5+
plt.figure()
6+
x = np.arange(5)
7+
y1 = np.array([1, 2, 1, 4, 2])
8+
y2 = np.array([1, 2, 1, 4, 2])
9+
y3 = np.array([1, 2, 1, 4, 2])
10+
y4 = np.array([1, 2, 1, 4, 2])
11+
12+
plt.step(x, y1, 'r-')
13+
plt.step(x, y2, 'b--', where='pre')
14+
plt.step(x, y3, 'g-.', where='post')
15+
plt.step(x, y4, 'y:', where='mid')
16+
plt.legend(['default', 'pre', 'post', 'mid'])
17+
18+
return plt.gcf()
19+
20+
21+
if __name__ == "__main__":
22+
import helpers
23+
24+
helpers.compare_mpl_latex(plot)

test/test_steps_reference.tex

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
% This file was created by tikzplotlib v0.8.0.
2+
\begin{tikzpicture}
3+
4+
\definecolor{color0}{rgb}{0.75,0.75,0}
5+
6+
\begin{axis}[
7+
axis background/.style={fill=white!89.80392156862746!black},
8+
axis line style={white},
9+
legend cell align={left},
10+
legend style={at={(0.03,0.97)}, anchor=north west, draw=white!80.0!black, fill=white!89.80392156862746!black},
11+
tick align=outside,
12+
tick pos=left,
13+
x grid style={white},
14+
xmajorgrids,
15+
xmin=-0.2, xmax=4.2,
16+
xtick style={color=white!33.33333333333333!black},
17+
y grid style={white},
18+
ymajorgrids,
19+
ymin=0.85, ymax=4.15,
20+
ytick style={color=white!33.33333333333333!black}
21+
]
22+
\addplot [semithick, red, const plot mark right]
23+
table {%
24+
0 1
25+
1 2
26+
2 1
27+
3 4
28+
4 2
29+
};
30+
\addlegendentry{default}
31+
\addplot [semithick, blue, const plot mark right, dashed]
32+
table {%
33+
0 1
34+
1 2
35+
2 1
36+
3 4
37+
4 2
38+
};
39+
\addlegendentry{pre}
40+
\addplot [semithick, green!50.0!black, const plot mark left, dash pattern=on 1pt off 3pt on 3pt off 3pt]
41+
table {%
42+
0 1
43+
1 2
44+
2 1
45+
3 4
46+
4 2
47+
};
48+
\addlegendentry{post}
49+
\addplot [semithick, color0, const plot mark mid, dotted]
50+
table {%
51+
0 1
52+
1 2
53+
2 1
54+
3 4
55+
4 2
56+
};
57+
\addlegendentry{mid}
58+
\end{axis}
59+
60+
\end{tikzpicture}

0 commit comments

Comments
 (0)