[SciPy-user] surface plotting

Gael Varoquaux gael.varoquaux@normalesup....
Sun Dec 2 10:49:44 CST 2007


On Sat, Dec 01, 2007 at 10:24:42PM +0530, Prabhu Ramachandran wrote:
> Unfortunately, these still use tvtk's mlab which is lower level and not 
> as powerful as mayavi's new mlab.

> The best docs for that are here:

>   https://svn.enthought.com/enthought/attachment/wiki/MayaVi/mlab.pdf


Quickly, you can have a feeling of how to plot surface using mlab by
folliwing these steps:

run "ipython -wthread"

execute the following python code:

+++++++++++++++++++++++++++++++++++++++
In [1]: from enthought.mayavi.tools import mlab as M
Set Envisage to use the workbench UI: True
Set Envisage to use the workbench UI: True

In [2]: from scipy import *

In [3]: X, Y = mgrid[-1:1:50j, -1:1:50j]

In [4]: Z = cos(4*(X**2+Y**2))

In [5]: M.surf(X, Y, Z)
+++++++++++++++++++++++++++++++++++++++


This will bring up a Mayavi2 window with the surface plotted. The mlab
API is similar to matplotlib's pylab, so you should feel quite familiar
with it. It is still young and I haven't had time to put as much work as
I would like in it. Documentation is lacking, but the docstrings are
quite good. Just reading "help(M)" in the example above should hopefully
give you an idea of the possbilities. The docs pointed to by Prabhu
should also be helpful.

HTH,

Gaël


More information about the SciPy-user mailing list