[SciPy-user] surface plotting
Thu Dec 6 00:53:42 CST 2007
Lorenzo Isella wrote:
>> Sure. Tell us a bit more about your usecase. Do you want to produce
>> figures for print/publication, do you want to interact with your data, or
>> do you want simply to do some 3D plotting in a program of yours. You can
>> do all this with Mayavi, but the solutions will depend a bit of your usecase.
> Well, seen that you ask, I often run thermo-hydraulic simulations.
> I usually end up having a set of numerical values to plot on a
> non-trivial domain rather than an analytical function.
In such cases you might be better served by mayavi. The only difficulty
is that for non-trivial domains you'll have to figure out how best to
represent your data (structured/unstructured etc.). In fact if you
really have velocity data in 3D it is nice to be able to see the flow in
3D using either velocity vectors or streamlines, both of which mayavi
> This can sometimes be done using a contour plot in matplotlib, but I am
> also looking for alternatives.
> For instance, let us say that I want to plot some scalar (say a
> component of the velocity) on the cross section of a tube (I simply
> generate random numbers here; in reality I would read it from a file).
> With pylab, this is what I would do:
> Can I do something similar with mayavi? And how?
With the script you sent, you could do this:
from enthought.mayavi.tools import mlab
s = mlab.surf(X, Y, Z, colormap='jet')
This will give you a 3D surface. You can't set the contours directly
but you certainly can modify the returned object or do this from the UI.
s.enable_contours = True
s.contour.filled_contours = True
s.contour.contours = range(-17, 16)
If you have vector data you can use either the flow or quiver mlab
functions. More on that in the mlab documentation.
Anyway, attached is a script that does what you need for your example
with mlab. It doesn't do anything special that your pylab version
doesn't but it does give you 3D and opens up other possibilities.
If you have other questions on mlab and datasets for non-trivial domains
please don't hesitate to ask on the enthought-dev list.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 974 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20071206/7a1882ee/attachment.py
More information about the SciPy-user