@@ -88,29 +88,11 @@ def test_all_points_on_plane():
88
88
89
89
90
90
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 )
95
94
96
95
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