On Sun, Dec 04, 2011 at 03:47:33PM +0100, andre...@club.lemonde.fr wrote: > [1] I would like to make the diameter of each graph edge (tube) depend on an > associated weight value. My impression is that tube_radius can only be a > single value, not a vector, so I imagine a loop is required. Is that correct?
We can do slightly better, but it is non trivial. I posted some code to do this recently on the enthought-dev mailing list (where many of the Mayavi related discussions happen): https://mail.enthought.com/pipermail/enthought-dev/2011-November/030194.html You will need to study it and do some reading of the Mayavi documentation on the pipeline and the difference modules to understand it. > [2] I am somewhat confused by the lines > pts.mlab_source.dataset.lines = np.array(G.edges()) > tube = mlab.pipeline.tube(pts, tube_radius=0.01) > in that it is not immediately obvious that a points3d object has lines > associated with it. Or are these /created/ here (1st line)? Yes. > Then how does the 2nd line 'know' that the tube shapes need to be > applied to the /lines/? Because they cannot be applied to anything else: tubes cannot be applied to points, surfaces or volumes. > Please point to relevant docs if this is explained somewhere. The following documentation could be useful: http://github.enthought.com/mayavi/mayavi/data.html > [3] Would curved tubes be possible? No, but you can approximate them with a specific graph introducing intermediate nodes to create a curvature in between the nodes that you are actually interested in. > [4] What about arrowheads, for a directed graph? Not easy at all. I suggest that you get more familiar with Mayavi (i.e. really familiar) before trying to tackle this problem. It would probably take me a few hours to get something going here. > I'm not sure how to even start approaching [3] and [4], so a general > idea would be very welcome. If you don't have performance concerns, the easiest approach is to use a for loop with other primitives, such as mlab.plot and mlab.quiver. Of course, this will be much slower. HTH, Gael ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ MayaVi-users mailing list MayaVi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mayavi-users