Gael Varoquaux | 17 Jul 02:29
Favicon

Re: Modify surf output (axes, scaling)

On Wed, Jul 16, 2008 at 11:57:56PM +0200, Thomas Königstein wrote:
>    Now, with either method, I have the problem when the values of the x,y
>    coordinates are of a different magnitude (i.e. much bigger/smaller) as the
>    value of the z- (i.e. my_data)-coordinate. (For example, x,y being
>    micrometer --> around 1.e-6 while z is around 1e4, or x,y being
>    [1,2,3,...] while z is ~1e-10) So when I view the plot, I get either a
>    thin line when my_data is much bigger than x,y; or I get a flat plane when
>    my_data is negligible compared to x,y. Only when they by chance happen to
>    have the same magnitude, the 3d outline is a nice cuboid.
>    A solution is to use the "WarpScalar" filter to shrink/expand the z-axis,
>    but then the values also change, and the z-axis becomes useless. It's also
>    possible to change the "Spacing" for x,y (changing z seems to be broken
>    for me here) in the "Array2DSource" object editor, but then the x,y values
>    become incorrect. So, my question is: How can I change the height of a
>    graph without changing the values?

The good answer is that the latest version of Mayavi (2.2, in ETS 2.8)
added a "scale_z" argument that controls the scale of the z axis to do
what you want. By default it auto scales your data. It is not yet in
python(x,y), sorry. You might want to ask Pierre to update python(x,y)

Now what you can do in the mean time is sue the extents keyword argument,
say if you want an 1,1,1 aspect ratio use:

mlab.surf(my_data, extent=[0, 1, 0, 1, 0, 1])

Try this out, and tell us if it does the tric.

Cheers,

Gaël

PS: Another nice way of getting Mayavi2 and Co is to use the enthought
python distribution (www.enthought.com/products/epddownload.php)

Gmane