Skip to content

Commit 14e64f0

Browse files
committed
add another legend test
1 parent 6d244db commit 14e64f0

12 files changed

+81
-19
lines changed

test/test_legend3.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
import matplotlib.pyplot as plt
4+
5+
6+
def plot():
7+
# mpl.style.use("seaborn-colorblind")
8+
fig = plt.figure(figsize=(7, 4))
9+
ax = fig.add_subplot(111)
10+
ax.fill_between([1, 2], [2, 2], [3, 3], color="red", alpha=0.2, label="roh")
11+
ax.fill_between([1, 2], [4, 4], [5, 5], color="blue", alpha=0.2, label="kal")
12+
ax.plot([1, 2], [2, 5], "k", label="ref")
13+
ax.grid()
14+
plt.legend()
15+
return
16+
17+
18+
if __name__ == "__main__":
19+
import helpers
20+
21+
helpers.compare_mpl_latex(plot)
22+
# helpers.print_tree(plot())

test/test_legend3_reference.tex

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
\begin{tikzpicture}
2+
3+
\begin{axis}[
4+
legend cell align={left},
5+
legend entries={{ref},{roh},{kal}},
6+
legend style={at={(0.03,0.97)}, anchor=north west, draw=white!80.0!black},
7+
tick align=outside,
8+
tick pos=left,
9+
x grid style={white!69.01960784313725!black},
10+
xmajorgrids,
11+
xmin=0.95, xmax=2.05,
12+
y grid style={white!69.01960784313725!black},
13+
ymajorgrids,
14+
ymin=1.85, ymax=5.15
15+
]
16+
\addlegendimage{no markers, black}
17+
\path [draw=red, fill=red, opacity=0.2] (axis cs:1,3)
18+
--(axis cs:1,2)
19+
--(axis cs:2,2)
20+
--(axis cs:2,3)
21+
--(axis cs:2,3)
22+
--(axis cs:1,3)
23+
--cycle;
24+
25+
\path [draw=blue, fill=blue, opacity=0.2] (axis cs:1,5)
26+
--(axis cs:1,4)
27+
--(axis cs:2,4)
28+
--(axis cs:2,5)
29+
--(axis cs:2,5)
30+
--(axis cs:1,5)
31+
--cycle;
32+
33+
\addplot [semithick, black]
34+
table {%
35+
1 2
36+
2 5
37+
};
38+
\end{axis}
39+
40+
\end{tikzpicture}

test/test_legend_best_location_reference.tex

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

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
4-
\definecolor{color1}{rgb}{0,0.619607843137255,0.450980392156863}
5-
\definecolor{color2}{rgb}{0.835294117647059,0.368627450980392,0}
6-
\definecolor{color3}{rgb}{0.8,0.474509803921569,0.654901960784314}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
4+
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
5+
\definecolor{color2}{rgb}{0.172549019607843,0.627450980392157,0.172549019607843}
6+
\definecolor{color3}{rgb}{0.83921568627451,0.152941176470588,0.156862745098039}
77

88
\begin{groupplot}[group style={group size=3 by 3}]
99
\nextgroupplot[

test/test_legend_columns_reference.tex

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

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
4-
\definecolor{color1}{rgb}{0,0.619607843137255,0.450980392156863}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
4+
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
55

66
\begin{axis}[
77
legend cell align={left},

test/test_legend_labels_reference.tex

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

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
4-
\definecolor{color1}{rgb}{0,0.619607843137255,0.450980392156863}
5-
\definecolor{color2}{rgb}{0.835294117647059,0.368627450980392,0}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
4+
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
5+
\definecolor{color2}{rgb}{0.172549019607843,0.627450980392157,0.172549019607843}
66

77
\begin{axis}[
88
legend cell align={left},

test/test_legends2_reference.tex

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

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
4-
\definecolor{color1}{rgb}{0,0.619607843137255,0.450980392156863}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
4+
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
55

66
\begin{groupplot}[group style={group size=3 by 3}]
77
\nextgroupplot[

test/test_line_collection_reference.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\begin{tikzpicture}
22

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
44

55
\begin{axis}[
66
colorbar,

test/test_line_color_marker_reference.tex

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

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
4-
\definecolor{color1}{rgb}{0,0.619607843137255,0.450980392156863}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
4+
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
55

66
\begin{axis}[
77
axis background/.style={fill=white!89.80392156862746!black},

test/test_loglogplot_reference.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\begin{tikzpicture}
22

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
44

55
\begin{axis}[
66
log basis x={10},

test/test_patches_reference.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\begin{tikzpicture}
22

3-
\definecolor{color0}{rgb}{0,0.447058823529412,0.698039215686274}
3+
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
44

55
\begin{axis}[
66
colorbar,

0 commit comments

Comments
 (0)