thanks very much for you answer. Numpy's clip and the extent keyword fixed
the problem.

Regards,
Gérard

2009/3/27 Prabhu Ramachandran <[email protected]>

> Hi,
>
> On 03/25/09 20:18, gerard manvussa wrote:
>
>> I am trying to plot a surface using the enthought.mayavi.mlab module.
>>
>> My problem is that my data along the x-axis and y-axis are not of the same
>> order, and so the resulting surface is completely shrinked... I do have to
>> renormalize the data to obtain a surface that's really looks like one...
>>
>> for instance, if I do:
>>
>> from scipy import *
>> from enthought.mayavi import mlab
>>
>> x, y = mgrid[-100:100:1, -1:1:0.01]
>> z = random.rand(*x.shape)
>> s = mlab.surf(x, y, z)  #the surface displayed is completely shrinked on
>> the y axis and z axis ( =1/100 of the x values)
>> mlab.show()
>>
>> How can I control the scaling without renormalizing the inputs x, y, z ?
>>
>
> It looks like you have an older version of mlab.  This behavior of surf was
> fixed in version 3.1.0 IIRC, but in the meanwhile you can pass the extent
> keyword argument to set the specific size of the extent.  Either that or you
> will have to use the warp_scale argument.  I can't remember at this point.
>  Regardless, using 3.1.0 or 3.2.0 should solve your problem.
>
>  Similarly, how can I limit the values displayed on the z-axis ? for
>> example it could be, I have a couple of points with irrealisticly big
>> values, and do not want them to appear in the graph... with the code above,
>> If I do:
>>
>> z[2, 13] = 100000
>> mlab.surf(x,y,z)
>>
>> will display this 100000 point and corrupt the surface display... say I
>> just want to ignore it and keep values between [0, 1] ? I have tried to play
>> around with the mlab.axes() but it does help. Is there any mean ? I do not
>> want to filter my input data as it is too big.
>>
>
> I think you can use numpy's clip to clip the data or replace the larger
> values with NaN. For example try this:
>
>  x, y = mgrid[-1:1:0.01, -1:1:0.01]
>  z = random.rand(*x.shape)
>  z[100:140] = NaN
>  mlab.surf(x, y, z)
>
> This doesn't render the NaN values.
>
> BTW, you may be better served asking questions on
> [email protected] also.
>
> HTH.
>
> cheers,
> prabhu
>
>
------------------------------------------------------------------------------
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to