I have used the following code (taken from a matplotlib example) to produce a 3D plot of planar polygons,

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

np.random.seed(40040157) # Used to allow repeatable experiments (plots)

fig = plt.figure()
ax = fig.gca(projection='3d')

cc = [colorConverter.to_rgba(c,alpha=0.6) for c in ('r','g','b','c','y','m','k')]
ncc = len(cc)
nxs = 5
xs = np.arange(1, nxs+1, 1) # (X's)

# Add boundary X's
xs = np.insert(xs,0,1);
xs = np.append(xs,nxs) 

# Create array for Z's
ys = np.zeros(len(xs))

# Create list for all Y's
npolys = 9
zs = [zs+1 for zs in range(npolys)] # Y coordinates (list of integers)
# Create list of colors (cyclic) for all polygons
colorlist = [cc[j%ncc] for j in range(npolys)]    

verts = []
# Generate vertices for polygons
for j in zs: # loop on polys
    ys = np.random.rand(len(ys))    
    ys[0], ys[-1] = 0,0              # end points for filled polygons (1,0),(n,0)
    verts.append(zip(xs, ys))       

poly = PolyCollection(verts, facecolors = colorlist)
ax.add_collection3d(poly, zs=zs, zdir='y')

# Right-handed coordinate system
ax.set_xlabel('X')   # points to right (X)
ax.set_xlim3d(0, nxs+1)    
ax.set_ylabel('Y')   # points into screen (Y)
ax.set_ylim3d(0, npolys+1)
ax.set_zlabel('Z')  # points up (Z)
ax.set_zlim3d(0, 1)


and this works fine. I then tried to produce a 3D plot of the same form as this one, but with only the top of the polygons plotted (4 connected line
segments for each of the 9 polygons).  I thought this would be easily accomplished, by replacing PolyCollection with LineCollection. However, I have been unable to produce a 3D plot for line segments connecting the tops of the polygons.

Note, I am using Python 2.6.6, numpy 1.5.1, and matplotlib 1.0.1.

Any help on producing 3D line segment plot would be appreciated.