I am making a plot as in:
http://matplotlib.org/examples/mplot3d/polys3d_demo.html
but in the example they declare:
ys[0], ys[-1] = 0, 0
so that the polygons have a point on the x,y plane.
My data does not have zeros at the end points. So, when I plot it, the polygons do not touch the x,y plane as they do nicely in the example. Is there a hack to make the polygons drop to the (x,y) plane even if the f(x,y) datapoint at the end points is not zero?
Here is my code now. The (x,y) plane is determined by the 1D arrays U_array and d_array. The z-variable is called zvar and is a 2D array:
fig = plt.figure()
ax = fig.gca(projection='3d')
xs = U_array
verts = []
zs = list(d_array)
indx = 0
for z in zs:
ys = np.copy(zvar[:,indx])
# ys[0], ys[-1] = 0, 0
verts.append(list(zip(xs, ys)))
indx = indx + 1
poly = PolyCollection(verts, facecolors = facecolors)
poly.set_alpha(0.7)
ax.add_collection3d(poly, zs=zs, zdir='y')
plt.show()
How can I make my plot without the commented line above where I artificially make my data points zero at the ends?
Thanks. Also, out of curiosity, why is zs in here not really the z-variable? ...