Hi Ben, in your example > http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html the essential line is: ax.add_collection3d(poly, zs=zs, zdir='y') according to everything I see this can only draw something that is made out of several axes parallel parts. I don't think how with such a command you could end up with some picture like: http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/surface3d_demo.hires.png What I want to plot should look like that picture (with is part of your gallery), just that I don't have a meshgrid data underlying.
Your second example seems to have the same limitation http://matplotlib.sourceforge.net/examples/mplot3d/pathpatch3d_demo.html just it works with the command art3d.pathpatch_2d_to_3d(p, z=0, zdir="x") The only way that I currently see is that I call ax.plot_surface() for each quadrilateral of my mesh. I'm actually only looking for a function which can shade a set of polygons that make up a picture like http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/surface3d_demo.hires.png I might be able to limit the polygons to be quadrilaterals only. The mesh will be nice in the sense that polygons do not intersect. Otherwise the list of polygons should be arbitrary. -Holger On Thu, Sep 29, 2011 at 17:33, Benjamin Root <ben.r...@ou.edu> wrote: > On Thu, Sep 29, 2011 at 4:09 AM, Holger Brandsmeier > <holger.brandsme...@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 > > -- Holger Brandsmeier, SAM, ETH Zürich http://www.sam.math.ethz.ch/people/bholger ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users