8000 TST: Change tests to use default styles · matplotlib/matplotlib@c641607 · GitHub
[go: up one dir, main page]

Skip to content

Commit c641607

Browse files
committed
TST: Change tests to use default styles
As requested in review feedback - since all the images changed, may as well restyle them. Note that this restyling caused a test to become platform-dependent on the anti-aliasing on the edges of a narrow line - presumably due to the resolution decrease making the line narrower - so a non-zero `tol` value was added.
1 parent c95fea3 commit c641607

File tree

1 file changed

+66
-35
lines changed

1 file changed

+66
-35
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def test_aspect_equal_error():
1818
ax.set_aspect('equal')
1919

2020

21-
@image_comparison(['bar3d.png'], remove_text=True)
21+
@image_comparison(['bar3d.png'],
22+
remove_text=True, style='default')
2223
def test_bar3d():
2324
fig = plt.figure()
2425
ax = fig.add_subplot(111, projection='3d')
@@ -30,7 +31,8 @@ def test_bar3d():
3031
ax.bar(xs, ys, zs=z, zdir='y', align='edge', color=cs, alpha=0.8)
3132

3233

33-
@image_comparison(['bar3d_shaded.png'], remove_text=True)
34+
@image_comparison(['bar3d_shaded.png'],
35+
remove_text=True, style='default')
3436
def test_bar3d_shaded():
3537
x = np.arange(4)
3638
y = np.arange(5)
@@ -50,7 +52,8 @@ def test_bar3d_shaded():
5052
fig.canvas.draw()
5153

5254

53-
@image_comparison(['bar3d_notshaded.png'], remove_text=True)
55+
@image_comparison(['bar3d_notshaded.png'],
56+
remove_text=True, style='default')
5457
def test_bar3d_notshaded():
5558
fig = plt.figure()
5659
ax = fig.add_subplot(111, projection='3d')
@@ -63,7 +66,8 @@ def test_bar3d_notshaded():
6366
fig.canvas.draw()
6467

6568

66-
@image_comparison(['contour3d.png'], remove_text=True, style='mpl20')
69+
@image_comparison(['contour3d.png'],
70+
remove_text=True, style='default')
6771
def test_contour3d():
6872
fig = plt.figure()
6973
ax = fig.gca(projection='3d')
@@ -76,7 +80,8 @@ def test_contour3d():
7680
ax.set_zlim(-100, 100)
7781

7882

79-
@image_comparison(['contourf3d.png'], remove_text=True)
83+
@image_comparison(['contourf3d.png'],
84+
remove_text=True, style='default')
8085
def test_contourf3d():
8186
fig = plt.figure()
8287
ax = fig.gca(projection='3d')
@@ -89,7 +94,8 @@ def test_contourf3d():
8994
ax.set_zlim(-100, 100)
9095

9196

92-
@image_comparison(['contourf3d_fill.png'], remove_text=True)
97+
@image_comparison(['contourf3d_fill.png'],
98+
remove_text=True, style='default')
9399
def test_contourf3d_fill():
94100
fig = plt.figure()
95101
ax = fig.gca(projection='3d')
@@ -104,7 +110,8 @@ def test_contourf3d_fill():
104110
ax.set_zlim(-1, 1)
105111

106112

107-
@image_comparison(['tricontour.png'], remove_text=True, style='mpl20')
113+
@image_comparison(['tricontour.png'],
114+
remove_text=True, style='default')
108115
def test_tricontour():
109116
fig = plt.figure()
110117

@@ -119,7 +126,8 @@ def test_tricontour():
119126
ax.tricontourf(x, y, z)
120127

121128

122-
@image_comparison(['lines3d.png'], remove_text=True)
129+
@image_comparison(['lines3d.png'],
130+
remove_text=True, style='default')
123131
def test_lines3d():
124132
fig = plt.figure()
125133
ax = fig.gca(projection='3d')
@@ -131,7 +139,8 @@ def test_lines3d():
131139
ax.plot(x, y, z)
132140

133141

134-
@image_comparison(['mixedsubplot.png'], remove_text=True)
142+
@image_comparison(['mixedsubplot.png'],
143+
remove_text=True, style='default')
135144
def test_mixedsubplots():
136145
def f(t):
137146
return np.cos(2*np.pi*t) * np.exp(-t)
@@ -168,7 +177,8 @@ def test_tight_layout_text(fig_test, fig_ref):
168177
ax2.text(.5, .5, .5, s='some string')
169178

170179

171-
@image_comparison(['scatter3d.png'], remove_text=True)
180+
@image_comparison(['scatter3d.png'],
181+
remove_text=True, style='default')
172182
def test_scatter3d():
173183
fig = plt.figure()
174184
ax = fig.add_subplot(111, projection='3d')
@@ -178,7 +188,8 @@ def test_scatter3d():
178188
c='b', marker='^')
179189

180190

181-
@image_comparison(['scatter3d_color.png'], remove_text=True)
191+
@image_comparison(['scatter3d_color.png'],
192+
remove_text=True, style='default')
182193
def test_scatter3d_color():
183194
fig = plt.figure()
184195
ax = fig.add_subplot(111, projection='3d')
@@ -188,7 +199,8 @@ def test_scatter3d_color():
188199
color='b', marker='s')
189200

190201

191-
@image_comparison(['plot_3d_from_2d.png'], remove_text=True)
202+
@image_comparison(['plot_3d_from_2d.png'],
203+
remove_text=True, style='default', tol=0.01)
192204
def test_plot_3d_from_2d():
193205
fig = plt.figure()
194206
ax = fig.add_subplot(111, projection='3d')
@@ -198,7 +210,8 @@ def test_plot_3d_from_2d():
198210
ax.plot(xs, ys, zs=0, zdir='y')
199211

200212

201-
@image_comparison(['surface3d.png'], remove_text=True)
213+
@image_comparison(['surface3d.png'],
214+
remove_text=True, style='default')
202215
def test_surface3d():
203216
fig = plt.figure()
204217
ax = fig.gca(projection='3d')
@@ -213,7 +226,8 @@ def test_surface3d():
213226
fig.colorbar(surf, shrink=0.5, aspect=5)
214227

215228

216-
@image_comparison(['surface3d_shaded.png'], remove_text=True)
229+
@image_comparison(['surface3d_shaded.png'],
230+
remove_text=True, style='default')
217231
def test_surface3d_shaded():
218232
fig = plt.figure()
219233
ax = fig.gca(projection='3d')
@@ -227,7 +241,7 @@ def test_surface3d_shaded():
227241
ax.set_zlim(-1.01, 1.01)
228242

229243

230-
@image_comparison(['text3d.png'])
244+
@image_comparison(['text3d.png'], style='default')
231245
def test_text3d():
232246
fig = plt.figure()
233247
ax = fig.gca(projection='3d')
@@ -251,7 +265,8 @@ def test_text3d():
251265
ax.set_zlabel('Z axis')
252266

253267

254-
@image_comparison(['trisurf3d.png'], remove_text=True, tol=0.03)
268+
@image_comparison(['trisurf3d.png'],
269+
remove_text=True, tol=0.03, style='default')
255270
def test_trisurf3d():
256271
n_angles = 36
257272
n_radii = 8
@@ -269,7 +284,8 @@ def test_trisurf3d():
269284
ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)
270285

271286

272-
@image_comparison(['trisurf3d_shaded.png'], remove_text=True, tol=0.03)
287+
@image_comparison(['trisurf3d_shaded.png'],
288+
remove_text=True, tol=0.03, style='default')
273289
def test_trisurf3d_shaded():
274290
n_angles = 36
275291
n_radii = 8
@@ -287,23 +303,26 @@ def test_trisurf3d_shaded():
287303
ax.plot_trisurf(x, y, z, color=[1, 0.5, 0], linewidth=0.2)
288304

289305

290-
@image_comparison(['wireframe3d.png'], remove_text=True)
306+
@image_comparison(['wireframe3d.png'],
307+
remove_text=True, style='default')
291308
def test_wireframe3d():
292309
fig = plt.figure()
293310
ax = fig.add_subplot(111, projection='3d')
294311
X, Y, Z = axes3d.get_test_data(0.05)
295312
ax.plot_wireframe(X, Y, Z, rcount=13, ccount=13)
296313

297314

298-
@image_comparison(['wireframe3dzerocstride.png'], remove_text=True)
315+
@image_comparison(['wireframe3dzerocstride.png'],
316+
remove_text=True, style='default')
299317
def test_wireframe3dzerocstride():
300318
fig = plt.figure()
301319
ax = fig.add_subplot(111, projection='3d')
302320
X, Y, Z = axes3d.get_test_data(0.05)
303321
ax.plot_wireframe(X, Y, Z, rcount=13, ccount=0)
304322

305323

306-
@image_comparison(['wireframe3dzerorstride.png'], remove_text=True)
324+
@image_comparison(['wireframe3dzerorstride.png'],
325+
remove_text=True, style='default')
307326
def test_wireframe3dzerorstride():
308327
fig = plt.figure()
309328
ax = fig.add_subplot(111, projection='3d')
@@ -329,7 +348,8 @@ def test_mixedsamplesraises():
329348
ax.plot_surface(X, Y, Z, cstride=50, rcount=10)
330349

331350

332-
@image_comparison(['quiver3d.png'], remove_text=True)
351+
@image_comparison(['quiver3d.png'],
352+
remove_text=True, style='default')
333353
def test_quiver3d():
334354
fig = plt.figure()
335355
ax = fig.gca(projection='3d')
@@ -344,7 +364,8 @@ def test_quiver3d():
344364
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tip', normalize=True)
345365

346366

347-
@image_comparison(['quiver3d_empty.png'], remove_text=True)
367+
@image_comparison(['quiver3d_empty.png'],
368+
remove_text=True, style='default')
348369
def test_quiver3d_empty():
349370
fig = plt.figure()
350371
ax = fig.gca(projection='3d')
@@ -359,7 +380,8 @@ def test_quiver3d_empty():
359380
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tip', normalize=True)
360381

361382

362-
@image_comparison(['quiver3d_masked.png'], remove_text=True)
383+
@image_comparison(['quiver3d_masked.png'],
384+
remove_text=True, style='default')
363385
def test_quiver3d_masked():
364386
fig = plt.figure()
365387
ax = fig.gca(projection='3d')
@@ -378,7 +400,8 @@ def test_quiver3d_masked():
378400
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tip', normalize=True)
379401

380402

381-
@image_comparison(['quiver3d_pivot_middle.png'], remove_text=True)
403+
@image_comparison(['quiver3d_pivot_middle.png'],
404+
remove_text=True, style='default')
382405
def test_quiver3d_pivot_middle():
383406
fig = plt.figure()
384407
ax = fig.gca(projection='3d')
@@ -393,7 +416,8 @@ def test_quiver3d_pivot_middle():
393416
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='middle', normalize=True)
394417

395418

396-
@image_comparison(['quiver3d_pivot_tail.png'], remove_text=True)
419+
@image_comparison(['quiver3d_pivot_tail.png'],
420+
remove_text=True, style='default')
397421
def test_quiver3d_pivot_tail():
398422
fig = plt.figure()
399423
ax = fig.gca(projection='3d')
@@ -408,7 +432,8 @@ def test_quiver3d_pivot_tail():
408432
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tail', normalize=True)
409433

410434

411-
@image_comparison(['poly3dcollection_closed.png'], remove_text=True)
435+
@image_comparison(['poly3dcollection_closed.png'],
436+
remove_text=True, style='default')
412437
def test_poly3dcollection_closed():
413438
fig = plt.figure()
414439
ax = fig.gca(projection='3d')
@@ -430,7 +455,8 @@ def test_poly_collection_2d_to_3d_empty():
430455
assert poly.get_paths() == []
431456

432457

433-
@image_comparison(['poly3dcollection_alpha.png'], remove_text=True)
458+
@image_comparison(['poly3dcollection_alpha.png'],
459+
remove_text=True, style='default')
434460
def test_poly3dcollection_alpha():
435461
fig = plt.figure()
436462
ax = fig.gca(projection='3d')
@@ -447,7 +473,7 @@ def test_poly3dcollection_alpha():
447473
ax.add_collection3d(c2)
448474

449475

450-
@image_comparison(['axes3d_labelpad.png'])
476+
@image_comparison(['axes3d_labelpad.png'], style='default')
451477
def test_axes3d_labelpad():
452478
from matplotlib import rcParams
453479

@@ -469,7 +495,7 @@ def test_axes3d_labelpad():
469495
tick.set_pad(tick.get_pad() - i * 5)
470496

471497

472-
@image_comparison(['axes3d_cla.png'])
498+
@image_comparison(['axes3d_cla.png'], style='default')
473499
def test_axes3d_cla():
474500
# fixed in pull request 4553
475501
fig = plt.figure()
@@ -540,7 +566,8 @@ def _test_proj_draw_axes(M, s=1, *args, **kwargs):
540566
return fig, ax
541567

542568

543-
@image_comparison(['proj3d_axes_cube.png'], remove_text=True, style='default')
569+
@image_comparison(['proj3d_axes_cube.png'],
570+
remove_text=True, style='default')
544571
def test_proj_axes_cube():
545572
M = _test_proj_make_M()
546573

@@ -672,7 +699,8 @@ def test_invalid_axes_limits(setter, side, value):
672699

673700

674701
class TestVoxels:
675-
@image_comparison(['voxels-simple.png'], remove_text=True)
702+
@image_comparison(['voxels-simple.png'],
703+
remove_text=True, style='default')
676704
def test_simple(self):
677705
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
678706

@@ -692,7 +720,8 @@ def test_edge_style(self):
692720
# change the edge color of one voxel
693721
v[max(v.keys())].set_edgecolor('C2')
694722

695-
@image_comparison(['voxels-named-colors.png'], remove_text=True)
723+
@image_comparison(['voxels-named-colors.png'],
724+
remove_text=True, style='default')
696725
def test_named_colors(self):
697726
"""Test with colors set to a 3d object array of strings."""
698727
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
@@ -705,7 +734,8 @@ def test_named_colors(self):
705734
colors[(x + z) < 10] = 'cyan'
706735
ax.voxels(voxels, facecolors=colors)
707736

708-
@image_comparison(['voxels-rgb-data.png'], remove_text=True)
737+
@image_comparison(['voxels-rgb-data.png'],
738+
remove_text=True, style='default')
709739
def test_rgb_data(self):
710740
"""Test with colors set to a 4d float array of rgb data."""
711741
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
@@ -718,7 +748,8 @@ def test_rgb_data(self):
718748
colors[..., 2] = z / 9
719749
ax.voxels(voxels, facecolors=colors)
720750

721-
@image_comparison(['voxels-alpha.png'], remove_text=True)
751+
@image_comparison(['voxels-alpha.png'],
752+
remove_text=True, style='default')
722753
def test_alpha(self):
723754
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
724755

@@ -736,7 +767,7 @@ def test_alpha(self):
736767
assert voxels[coord], "faces returned for absent voxel"
737768
assert isinstance(poly, art3d.Poly3DCollection)
738769

739-
@image_comparison(['voxels-xyz.png'], tol=0.01)
770+
@image_comparison(['voxels-xyz.png'], tol=0.01, style='default')
740771
def test_xyz(self):
741772
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
742773

0 commit comments

Comments
 (0)
0