On Thu, Sep 29, 2011 at 4:09 AM, Holger Brandsmeier <holger.brandsmeier@sam.math.ethz.ch> wrote:
Dear list,

is there an equivalent function to matlabs patch() function in matplotlib?
 http://dali.feld.cvut.cz/ucebna/matlab/techdoc/ref/patch.html
That means a function which does not require its X,Y,Z arguments to
come from a prior call to meshgrid? That is at least what I believe to
be the requirement for Axes3DSubplot.plot_surface.

In matlab you can pass n x k matrices as X,Y,Z argument, which then
means that there are n Polygons (each with k vertices) and they each
get shaded. The problem with the meshgrid structure is, that an
unstructured mesh does not have this tensor structure, so if I have
1000 quadrilaterals, then I would have to call
`Axes3DSubplot.plot_surface` for each of them separately. At least
with `gtkagg` this even seems to fail with z-buffer problem. Btw.
which backend to you recommend for 3D plots?

-Holger

There are some ways to do what you want.  For some simple examples:

http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html
http://matplotlib.sourceforge.net/examples/mplot3d/pathpatch3d_demo.html

These examples show how you can take a normal 2D matplotlib patch and convert it into a 3D object.

Unfortunately, I do not have any example on hand on how to work with the 3D versions of the objects directly, but that is possible. You can find the classes in the 'mpl_toolkits.mplot3d.art3d' module. Do keep in mind that mplot3d is currently only meant for simple 3D plots, as it can not properly lay out a 3D environment (intersecting polygons, for example will look Escher-like).  As for backends, the only thing that mplot3d requires is that it uses an Agg-based backend so that it can perform arbitrary rotation of text elements (for axes labels).

I hope this helps a bit.
Ben Root