MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_alpha

Method test_alpha

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py:1496–1511  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1494
1495 @mpl3d_image_comparison(['voxels-alpha.png'], style='mpl20')
1496 def test_alpha(self):
1497 fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
1498
1499 x, y, z = np.indices((10, 10, 10))
1500 v1 = x == y
1501 v2 = np.abs(x - y) < 2
1502 voxels = v1 | v2
1503 colors = np.zeros((10, 10, 10, 4))
1504 colors[v2] = [1, 0, 0, 0.5]
1505 colors[v1] = [0, 1, 0, 0.5]
1506 v = ax.voxels(voxels, facecolors=colors)
1507
1508 assert type(v) is dict
1509 for coord, poly in v.items():
1510 assert voxels[coord], "faces returned for absent voxel"
1511 assert isinstance(poly, art3d.Poly3DCollection)
1512
1513 @mpl3d_image_comparison(['voxels-xyz.png'], remove_text=False, style='mpl20',
1514 tol=0.002 if sys.platform == 'win32' else 0)

Callers

nothing calls this directly

Calls 2

voxelsMethod · 0.80
subplotsMethod · 0.45

Tested by

no test coverage detected