8000 Merge pull request #13133 from anntzer/polys3d · matplotlib/matplotlib@6dc5707 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6dc5707

Browse files
authored
Merge pull request #13133 from anntzer/polys3d
Simplify the polys3d example.
2 parents d23bcea + 0440a90 commit 6dc5707

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

examples/mplot3d/polys3d.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,11 @@
2020
np.random.seed(19680801)
2121

2222

23-
def cc(arg):
24-
'''
25-
Shorthand to convert 'named' colors to rgba format at 60% opacity.
26-
'''
27-
return mcolors.to_rgba(arg, alpha=0.6)
28-
29-
3023
def polygon_under_graph(xlist, ylist):
31-
'''
24+
"""
3225
Construct the vertex list which defines the polygon filling the space under
3326
the (xlist, ylist) line graph. Assumes the xs are in ascending order.
34-
'''
27+
"""
3528
return [(xlist[0], 0.), *zip(xlist, ylist), (xlist[-1], 0.)]
3629

3730

@@ -51,7 +44,7 @@ def polygon_under_graph(xlist, ylist):
5144
ys = np.random.rand(len(xs))
5245
verts.append(polygon_under_graph(xs, ys))
5346

54-
poly = PolyCollection(verts, facecolors=[cc('r'), cc('g'), cc('b'), cc('y')])
47+
poly = PolyCollection(verts, facecolors=['r', 'g', 'b', 'y'], alpha=.6)
5548
ax.add_collection3d(poly, zs=zs, zdir='y')
5649

5750
ax.set_xlabel('X')

0 commit comments

Comments
 (0)
0