Skip to content

Commit d1d170f

Browse files
committed
reintroduce contourf test
1 parent a3e9ac2 commit d1d170f

File tree

5 files changed

+77
-178
lines changed

5 files changed

+77
-178
lines changed

test/refresh_reference_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010

1111
def _main():
12-
parser = argparse.ArgumentParser(description='Refresh the reference TeX files.')
13-
parser.add_argument('files', nargs="+", help='Files to refresh')
12+
parser = argparse.ArgumentParser(description="Refresh the reference TeX files.")
13+
parser.add_argument("files", nargs="+", help="Files to refresh")
1414
args = parser.parse_args()
1515

1616
this_dir = os.path.dirname(os.path.abspath(__file__))

test/test_annotate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def plot():
3232

3333

3434
def test():
35-
assert_equality(plot, "test_annotate_reference.tex")
35+
assert_equality(plot, __file__[:-3] + "_reference.tex")
3636
return
3737

3838

test/test_contourf.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import matplotlib.pyplot as plt
44
import numpy as np
55

6+
from helpers import assert_equality
7+
68

79
def plot():
810
delta = 0.8
@@ -18,8 +20,13 @@ def plot():
1820
return fig
1921

2022

21-
# TODO reintroduce
22-
# from helpers import assert_equality
23-
# def test():
24-
# assert_equality(plot, __file__[:-3] + "_reference.tex")
25-
# return
23+
def test():
24+
assert_equality(plot, __file__[:-3] + "_reference.tex")
25+
return
26+
27+
28+
if __name__ == "__main__":
29+
import helpers
30+
31+
helpers.compare_mpl_latex(plot)
32+
# helpers.print_tree(plot())

test/test_contourf_reference.tex

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

3-
\definecolor{color0}{rgb}{1,0.416912181618064,0}
4-
\definecolor{color1}{rgb}{0.9113959702195,1,0}
5-
\definecolor{color2}{rgb}{0.401836637130755,1,0}
6-
\definecolor{color3}{rgb}{0,1,0.107722411056515}
7-
\definecolor{color4}{rgb}{0,1,0.617278533938476}
8-
\definecolor{color5}{rgb}{0,0.873164544120426,1}
9-
\definecolor{color6}{rgb}{0,0.363605211031682,1}
10-
\definecolor{color7}{rgb}{0.145954122057063,0,1}
11-
\definecolor{color8}{rgb}{0.655513455145808,0,1}
12-
\definecolor{color9}{rgb}{1,0,0.834927211765447}
13-
\definecolor{color10}{rgb}{1,0,0.325367878676702}
3+
\definecolor{color0}{rgb}{0.28291,0.105393,0.426902}
4+
\definecolor{color1}{rgb}{0.260571,0.246922,0.522828}
5+
\definecolor{color2}{rgb}{0.220057,0.343307,0.549413}
6+
\definecolor{color3}{rgb}{0.180629,0.429975,0.557282}
7+
\definecolor{color4}{rgb}{0.147607,0.511733,0.557049}
8+
\definecolor{color5}{rgb}{0.121148,0.592739,0.544641}
9+
\definecolor{color6}{rgb}{0.146616,0.67305,0.508936}
10+
\definecolor{color7}{rgb}{0.266941,0.748751,0.440573}
11+
\definecolor{color8}{rgb}{0.449368,0.813768,0.335384}
12+
\definecolor{color9}{rgb}{0.668054,0.861999,0.196293}
13+
\definecolor{color10}{rgb}{0.89632,0.893616,0.096335}
1414

1515
\begin{axis}[
1616
tick align=outside,
@@ -20,19 +20,7 @@
2020
y grid style={white!69.01960784313725!black},
2121
ymin=-3, ymax=2.6
2222
]
23-
\addplot [draw=none, fill=color0, colormap={mymap}{[1pt]
24-
rgb(0pt)=(1,0,0);
25-
rgb(10pt)=(1,0.9375,0);
26-
rgb(11pt)=(0.96875,1,0);
27-
rgb(21pt)=(0.03125,1,0);
28-
rgb(22pt)=(0,1,0.0625);
29-
rgb(32pt)=(0,1,1);
30-
rgb(42pt)=(0,0.0625,1);
31-
rgb(43pt)=(0.03125,0,1);
32-
rgb(53pt)=(0.96875,0,1);
33-
rgb(54pt)=(1,0,0.9375);
34-
rgb(63pt)=(1,0,0.09375)
35-
}]
23+
\addplot [draw=none, fill=color0, colormap/viridis]
3624
table{%
3725
x y
3826
0.999999999999999 0.984544248382579
@@ -43,19 +31,7 @@
4331
0.954435464355629 0.999999999999999
4432
0.999999999999999 0.984544248382579
4533
};
46-
\addplot [draw=none, fill=color1, colormap={mymap}{[1pt]
47-
rgb(0pt)=(1,0,0);
48-
rgb(10pt)=(1,0.9375,0);
49-
rgb(11pt)=(0.96875,1,0);
50-
rgb(21pt)=(0.03125,1,0);
51-
rgb(22pt)=(0,1,0.0625);
52-
rgb(32pt)=(0,1,1);
53-
rgb(42pt)=(0,0.0625,1);
54-
rgb(43pt)=(0.03125,0,1);
55-
rgb(53pt)=(0.96875,0,1);
56-
rgb(54pt)=(1,0,0.9375);
57-
rgb(63pt)=(1,0,0.09375)
58-
}]
34+
\addplot [draw=none, fill=color1, colormap/viridis]
5935
table{%
6036
x y
6137
0.999999999999999 0.857745486162581
@@ -73,19 +49,7 @@
7349
0.999999999999999 0.984544248382579
7450
0.954435464355629 0.999999999999999
7551
};
76-
\addplot [draw=none, fill=color2, colormap={mymap}{[1pt]
77-
rgb(0pt)=(1,0,0);
78-
rgb(10pt)=(1,0.9375,0);
79-
rgb(11pt)=(0.96875,1,0);
80-
rgb(21pt)=(0.03125,1,0);
81-
rgb(22pt)=(0,1,0.0625);
82-
rgb(32pt)=(0,1,1);
83-
rgb(42pt)=(0,0.0625,1);
84-
rgb(43pt)=(0.03125,0,1);
85-
rgb(53pt)=(0.96875,0,1);
86-
rgb(54pt)=(1,0,0.9375);
87-
rgb(63pt)=(1,0,0.09375)
88-
}]
52+
\addplot [draw=none, fill=color2, colormap/viridis]
8953
table{%
9054
x y
9155
0.999999999999999 0.730946723942583
@@ -105,19 +69,7 @@
10569
0.999999999999999 0.857745486162581
10670
0.580624674440804 0.999999999999999
10771
};
108-
\addplot [draw=none, fill=color3, colormap={mymap}{[1pt]
109-
rgb(0pt)=(1,0,0);
110-
rgb(10pt)=(1,0.9375,0);
111-
rgb(11pt)=(0.96875,1,0);
112-
rgb(21pt)=(0.03125,1,0);
113-
rgb(22pt)=(0,1,0.0625);
114-
rgb(32pt)=(0,1,1);
115-
rgb(42pt)=(0,0.0625,1);
116-
rgb(43pt)=(0.03125,0,1);
117-
rgb(53pt)=(0.96875,0,1);
118-
rgb(54pt)=(1,0,0.9375);
119-
rgb(63pt)=(1,0,0.09375)
120-
}]
72+
\addplot [draw=none, fill=color3, colormap/viridis]
12173
table{%
12274
x y
12375
0.199999999999999 0.876757367689047
@@ -138,19 +90,7 @@
13890
-0.271796711026647 0.999999999999999
13991
0.199999999999999 0.876757367689047
14092
};
141-
\addplot [draw=none, fill=color4, colormap={mymap}{[1pt]
142-
rgb(0pt)=(1,0,0);
143-
rgb(10pt)=(1,0.9375,0);
144-
rgb(11pt)=(0.96875,1,0);
145-
rgb(21pt)=(0.03125,1,0);
146-
rgb(22pt)=(0,1,0.0625);
147-
rgb(32pt)=(0,1,1);
148-
rgb(42pt)=(0,0.0625,1);
149-
rgb(43pt)=(0.03125,0,1);
150-
rgb(53pt)=(0.96875,0,1);
151-
rgb(54pt)=(1,0,0.9375);
152-
rgb(63pt)=(1,0,0.09375)
153-
}]
93+
\addplot [draw=none, fill=color4, colormap/viridis]
15494
table{%
15595
x y
15696
-0.600000000000001 0.944221756631701
@@ -177,19 +117,7 @@
177117
-1.05454755194753 0.999999999999999
178118
-0.600000000000001 0.944221756631701
179119
};
180-
\addplot [draw=none, fill=color5, colormap={mymap}{[1pt]
181-
rgb(0pt)=(1,0,0);
182-
rgb(10pt)=(1,0.9375,0);
183-
rgb(11pt)=(0.96875,1,0);
184-
rgb(21pt)=(0.03125,1,0);
185-
rgb(22pt)=(0,1,0.0625);
186-
rgb(32pt)=(0,1,1);
187-
rgb(42pt)=(0,0.0625,1);
188-
rgb(43pt)=(0.03125,0,1);
189-
rgb(53pt)=(0.96875,0,1);
190-
rgb(54pt)=(1,0,0.9375);
191-
rgb(63pt)=(1,0,0.09375)
192-
}]
120+
\addplot [draw=none, fill=color5, colormap/viridis]
193121
table{%
194122
x y
195123
1.8 -0.156923443951313
@@ -227,19 +155,7 @@
227155
1.50952288326628 0.199999999999999
228156
1.8 -0.156923443951313
229157
};
230-
\addplot [draw=none, fill=color6, colormap={mymap}{[1pt]
231-
rgb(0pt)=(1,0,0);
232-
rgb(10pt)=(1,0.9375,0);
233-
rgb(11pt)=(0.96875,1,0);
234-
rgb(21pt)=(0.03125,1,0);
235-
rgb(22pt)=(0,1,0.0625);
236-
rgb(32pt)=(0,1,1);
237-
rgb(42pt)=(0,0.0625,1);
238-
rgb(43pt)=(0.03125,0,1);
239-
rgb(53pt)=(0.96875,0,1);
240-
rgb(54pt)=(1,0,0.9375);
241-
rgb(63pt)=(1,0,0.09375)
242-
}]
158+
\addplot [draw=none, fill=color6, colormap/viridis]
243159
table{%
244160
x y
245161
-2.2 -3
@@ -283,19 +199,7 @@
283199
-0.600000000000001 -1.81799484012866
284200
-1.17921570873327 -1.4
285201
};
286-
\addplot [draw=none, fill=color6, colormap={mymap}{[1pt]
287-
rgb(0pt)=(1,0,0);
288-
rgb(10pt)=(1,0.9375,0);
289-
rgb(11pt)=(0.96875,1,0);
290-
rgb(21pt)=(0.03125,1,0);
291-
rgb(22pt)=(0,1,0.0625);
292-
rgb(32pt)=(0,1,1);
293-
rgb(42pt)=(0,0.0625,1);
294-
rgb(43pt)=(0.03125,0,1);
295-
rgb(53pt)=(0.96875,0,1);
296-
rgb(54pt)=(1,0,0.9375);
297-
rgb(63pt)=(1,0,0.09375)
298-
}]
202+
\addplot [draw=none, fill=color6, colormap/viridis]
299203
table{%
300204
x y
301205
-2.2 2.52214839745633
@@ -313,19 +217,7 @@
313217
-3 2.58589326730128
314218
-2.2 2.52214839745633
315219
};
316-
\addplot [draw=none, fill=color7, colormap={mymap}{[1pt]
317-
rgb(0pt)=(1,0,0);
318-
rgb(10pt)=(1,0.9375,0);
319-
rgb(11pt)=(0.96875,1,0);
320-
rgb(21pt)=(0.03125,1,0);
321-
rgb(22pt)=(0,1,0.0625);
322-
rgb(32pt)=(0,1,1);
323-
rgb(42pt)=(0,0.0625,1);
324-
rgb(43pt)=(0.03125,0,1);
325-
rgb(53pt)=(0.96875,0,1);
326-
rgb(54pt)=(1,0,0.9375);
327-
rgb(63pt)=(1,0,0.09375)
328-
}]
220+
\addplot [draw=none, fill=color7, colormap/viridis]
329221
table{%
330222
x y
331223
-0.600000000000001 -1.81799484012866
@@ -355,19 +247,7 @@
355247
-0.600000000000001 -1.26617921499118
356248
-1.26232771452348 -0.600000000000001
357249
};
358-
\addplot [draw=none, fill=color8, colormap={mymap}{[1pt]
359-
rgb(0pt)=(1,0,0);
360-
rgb(10pt)=(1,0.9375,0);
361-
rgb(11pt)=(0.96875,1,0);
362-
rgb(21pt)=(0.03125,1,0);
363-
rgb(22pt)=(0,1,0.0625);
364-
rgb(32pt)=(0,1,1);
365-
rgb(42pt)=(0,0.0625,1);
366-
rgb(43pt)=(0.03125,0,1);
367-
rgb(53pt)=(0.96875,0,1);
368-
rgb(54pt)=(1,0,0.9375);
369-
rgb(63pt)=(1,0,0.09375)
370-
}]
250+
\addplot [draw=none, fill=color8, colormap/viridis]
371251
table{%
372252
x y
373253
-0.600000000000001 -1.26617921499118
@@ -391,19 +271,7 @@
391271
-0.600000000000001 -0.869018808885087
392272
-0.867463482563093 -0.600000000000001
393273
};
394-
\addplot [draw=none, fill=color9, colormap={mymap}{[1pt]
395-
rgb(0pt)=(1,0,0);
396-
rgb(10pt)=(1,0.9375,0);
397-
rgb(11pt)=(0.96875,1,0);
398-
rgb(21pt)=(0.03125,1,0);
399-
rgb(22pt)=(0,1,0.0625);
400-
rgb(32pt)=(0,1,1);
401-
rgb(42pt)=(0,0.0625,1);
402-
rgb(43pt)=(0.03125,0,1);
403-
rgb(53pt)=(0.96875,0,1);
404-
rgb(54pt)=(1,0,0.9375);
405-
rgb(63pt)=(1,0,0.09375)
406-
}]
274+
\addplot [draw=none, fill=color9, colormap/viridis]
407275
table{%
408276
x y
409277
-0.600000000000001 -0.869018808885087
@@ -421,19 +289,7 @@
421289
0.199999999999999 -0.704221964488152
422290
-0.189953214926739 -0.600000000000001
423291
};
424-
\addplot [draw=none, fill=color10, colormap={mymap}{[1pt]
425-
rgb(0pt)=(1,0,0);
426-
rgb(10pt)=(1,0.9375,0);
427-
rgb(11pt)=(0.96875,1,0);
428-
rgb(21pt)=(0.03125,1,0);
429-
rgb(22pt)=(0,1,0.0625);
430-
rgb(32pt)=(0,1,1);
431-
rgb(42pt)=(0,0.0625,1);
432-
rgb(43pt)=(0.03125,0,1);
433-
rgb(53pt)=(0.96875,0,1);
434-
rgb(54pt)=(1,0,0.9375);
435-
rgb(63pt)=(1,0,0.09375)
436-
}]
292+
\addplot [draw=none, fill=color10, colormap/viridis]
437293
table{%
438294
x y
439295
0.199999999999999 -0.704221964488152

test/test_subplots_with_colorbars_reference.tex

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@
33
\begin{groupplot}[group style={group size=3 by 1}]
44
\nextgroupplot[
55
colorbar horizontal,
6-
colormap/viridis,
6+
colormap={mymap}{[1pt]
7+
rgb(0pt)=(1,0,0);
8+
rgb(10pt)=(1,0.9375,0);
9+
rgb(11pt)=(0.96875,1,0);
10+
rgb(21pt)=(0.03125,1,0);
11+
rgb(22pt)=(0,1,0.0625);
12+
rgb(32pt)=(0,1,1);
13+
rgb(42pt)=(0,0.0625,1);
14+
rgb(43pt)=(0.03125,0,1);
15+
rgb(53pt)=(0.96875,0,1);
16+
rgb(54pt)=(1,0,0.9375);
17+
rgb(63pt)=(1,0,0.09375)
18+
},
719
point meta max=1,
820
point meta min=0,
921
tick align=outside,
@@ -16,7 +28,19 @@
1628
\addplot graphics [includegraphics cmd=\pgfimage,xmin=-0.5, xmax=2.5, ymin=2.5, ymax=-0.5] {tmp-000.png};
1729
\nextgroupplot[
1830
colorbar horizontal,
19-
colormap/viridis,
31+
colormap={mymap}{[1pt]
32+
rgb(0pt)=(1,0,0);
33+
rgb(10pt)=(1,0.9375,0);
34+
rgb(11pt)=(0.96875,1,0);
35+
rgb(21pt)=(0.03125,1,0);
36+
rgb(22pt)=(0,1,0.0625);
37+
rgb(32pt)=(0,1,1);
38+
rgb(42pt)=(0,0.0625,1);
39+
rgb(43pt)=(0.03125,0,1);
40+
rgb(53pt)=(0.96875,0,1);
41+
rgb(54pt)=(1,0,0.9375);
42+
rgb(63pt)=(1,0,0.09375)
43+
},
2044
point meta max=1,
2145
point meta min=0,
2246
tick align=outside,
@@ -29,7 +53,19 @@
2953
\addplot graphics [includegraphics cmd=\pgfimage,xmin=-0.5, xmax=2.5, ymin=2.5, ymax=-0.5] {tmp-001.png};
3054
\nextgroupplot[
3155
colorbar horizontal,
32-
colormap/viridis,
56+
colormap={mymap}{[1pt]
57+
rgb(0pt)=(1,0,0);
58+
rgb(10pt)=(1,0.9375,0);
59+
rgb(11pt)=(0.96875,1,0);
60+
rgb(21pt)=(0.03125,1,0);
61+
rgb(22pt)=(0,1,0.0625);
62+
rgb(32pt)=(0,1,1);
63+
rgb(42pt)=(0,0.0625,1);
64+
rgb(43pt)=(0.03125,0,1);
65+
rgb(53pt)=(0.96875,0,1);
66+
rgb(54pt)=(1,0,0.9375);
67+
rgb(63pt)=(1,0,0.09375)
68+
},
3369
point meta max=1,
3470
point meta min=0,
3571
tick align=outside,

0 commit comments

Comments
 (0)