Skip to content

Commit 54b57b4

Browse files
vicliu2001scottshambaugh
authored andcommitted
modified test for _generate_normals
1 parent 7527850 commit 54b57b4

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

lib/mpl_toolkits/mplot3d/tests/test_art3d.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,11 @@ def test_all_points_on_plane():
8888

8989

9090
def test_generate_normals():
91-
92-
# Following code is an example taken from
93-
# https://stackoverflow.com/questions/18897786/transparency-for-poly3dcollection-plot-in-matplotlib
94-
# and modified to test _generate_normals function
91+
# Smoke test for https://github.com/matplotlib/matplotlib/issues/29156
92+
vertices = ((0, 0, 0), (0, 5, 0), (5, 5, 0), (5, 0, 0))
93+
shape = Poly3DCollection([vertices], edgecolors='r', shade=True)
9594

9695
fig = plt.figure()
97-
ax = fig.add_subplot(111, projection='3d')
98-
99-
x = [0, 2, 1, 1]
100-
y = [0, 0, 1, 0]
101-
z = [0, 0, 0, 1]
102-
103-
# deliberately use nested tuple
104-
vertices = ((0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3))
105-
106-
tupleList = list(zip(x, y, z))
107-
108-
poly3d = [[tupleList[vertices[ix][iy]] for iy in range(len(vertices[0]))]
109-
for ix in range(len(vertices))]
110-
ax.scatter(x, y, z)
111-
collection = Poly3DCollection(poly3d, alpha=0.2, edgecolors='r', shade=True)
112-
face_color = [0.5, 0.5, 1] # alternative: matplotlib.colors.rgb2hex([0.5, 0.5, 1])
113-
collection.set_facecolor(face_color)
114-
ax.add_collection3d(collection)
115-
116-
plt.draw()
96+
ax = fig.add_subplot(projection='3d')
97+
ax.add_collection3d(shape)
98+
plt.show()

0 commit comments

Comments
 (0)