I’m using matplotlib to plot some data as 2D curves in a 3D axes. I use the ax = axes3d.Axes3D() to define my axes and ax.plot(x, y, zs='z') to plot my 2D curves in the 3D space.
Now I want to add something that looks like what is on this page http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html, but I want to enter directly the coordinates of the vertex. In this example they have a fixed z array and they plot polygons with vertices (x,y), whereas what I want is z(x) and (x,y) vertices. Does anyone know how to do something like this?
And actually I don’t need the collection thing, I just want to plot one big square in an arbitrary direction.
I tried to simply enter the coordinates and use ax.plot():
verts = np.array([[0,0,0], [0,1,0], [1,1,1], [1,0,1], [0,0,0]])
ax.plot(verts[:,0], verts[:,1], verts[:,2], zdir='y')
and it indeed plots a square, but I can’t (or don’t know how to) fill the face.
I hope this is what you wanted!
My rectangle will go from 0 to 10. So MAX=10.
What I did at first is try to define an axis between z and x.
z=MAX-x was my choice.
And then I preceded to draw this axis for every small increment of x, thus creating the rectangle.
This is the code: