@@ -57,29 +57,11 @@ def test_zordered_error():
5757
5858
5959def test_generate_normals ():
60-
61- # Following code is an example taken from
62- # https://stackoverflow.com/questions/18897786/transparency-for-poly3dcollection-plot-in-matplotlib
63- # and modified to test _generate_normals function
60+ # Smoke test for https://github.com/matplotlib/matplotlib/issues/29156
61+ vertices = ((0 , 0 , 0 ), (0 , 5 , 0 ), (5 , 5 , 0 ), (5 , 0 , 0 ))
62+ shape = Poly3DCollection ([vertices ], edgecolors = 'r' , shade = True )
6463
6564 fig = plt .figure ()
66- ax = fig .add_subplot (111 , projection = '3d' )
67-
68- x = [0 , 2 , 1 , 1 ]
69- y = [0 , 0 , 1 , 0 ]
70- z = [0 , 0 , 0 , 1 ]
71-
72- # deliberately use nested tuple
73- vertices = ((0 , 1 , 2 ), (0 , 1 , 3 ), (0 , 2 , 3 ), (1 , 2 , 3 ))
74-
75- tupleList = list (zip (x , y , z ))
76-
77- poly3d = [[tupleList [vertices [ix ][iy ]] for iy in range (len (vertices [0 ]))]
78- for ix in range (len (vertices ))]
79- ax .scatter (x , y , z )
80- collection = Poly3DCollection (poly3d , alpha = 0.2 , edgecolors = 'r' , shade = True )
81- face_color = [0.5 , 0.5 , 1 ] # alternative: matplotlib.colors.rgb2hex([0.5, 0.5, 1])
82- collection .set_facecolor (face_color )
83- ax .add_collection3d (collection )
84-
85- plt .draw ()
65+ ax = fig .add_subplot (projection = '3d' )
66+ ax .add_collection3d (shape )
67+ plt .show ()
0 commit comments