Former-commit-id:a02aeb236c
[formerly9f19e3f712
] [formerlya02aeb236c
[formerly9f19e3f712
] [formerly06a8b51d6d
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]] Former-commit-id:06a8b51d6d
Former-commit-id:8e80217e59
[formerly3360eb6c5f
] Former-commit-id:377dcd10b9
30 lines
709 B
Python
Executable file
30 lines
709 B
Python
Executable file
from mpl_toolkits.mplot3d import Axes3D
|
|
from matplotlib.collections import PolyCollection
|
|
from matplotlib.colors import colorConverter
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
|
|
fig = plt.figure()
|
|
ax = Axes3D(fig)
|
|
|
|
cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
|
|
|
|
xs = np.arange(0, 10, 0.4)
|
|
verts = []
|
|
zs = [0.0, 1.0, 2.0, 3.0]
|
|
for z in zs:
|
|
ys = np.random.rand(len(xs))
|
|
ys[0], ys[-1] = 0, 0
|
|
verts.append(zip(xs, ys))
|
|
|
|
poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
|
|
cc('y')])
|
|
poly.set_alpha(0.7)
|
|
ax.add_collection3d(poly, zs=zs, zdir='y')
|
|
|
|
ax.set_xlim3d(0, 10)
|
|
ax.set_ylim3d(-1, 4)
|
|
ax.set_zlim3d(0, 1)
|
|
|
|
plt.show()
|
|
|