[SciPy-user] Simple plot problem

Guilherme P. de Freitas guilherme at gpfreitas.com
Tue Feb 17 07:05:25 EST 2009


>> So, I tried your code, and I got the same problem: the parametric
>> curves are "shrinked". I don't know if it's a bug in my system, but
>> the parametric curves are just not right. You can see a picture here:
>
>> http://archive.gpfreitas.com/misc/snapshot.png
>
> I am not sure why you are getting this. This might be because of a slight
> miss-feature that we corrected in a recent version of Mayavi2. What is
> your version of Mayavi2. I will try to get my hands on a computer where
> an older version of Mayavi2 to try things out.
>
> Also, did you use the exact same code as the one I sent you? Having the
> exact code will help me diagnose the problem.
>
> Cheers,
>
> Gaël

Hi again.

My version of Mayavi is 3.0.3.

I tried your code, exactly how you sent, and I got the same shrinked
object. I wanted to add a "representation='wireframe'" to the plot
to see more clearly, but for some reason it did not work in your
code (I still don't understand this very well). I decided to put
your code for the parametric curves in my previous code (that had
the function in wireframe style), and rotated it and took a
snapshot. That's what you sent. The exact code that generates that
picture in the link above is:

######################################################################
#!/usr/env python
import numpy as np
from enthought.mayavi import mlab

x, y = np.mgrid[0.0:3.0:0.1, 0.0:3.0:0.1]

def f(x,y):
    return x**(0.3) * y**(0.7)

utility = mlab.surf(x, y, f, representation='wireframe')
x = np.linspace(0, 1, 100)
mlab.plot3d(x, 2-2*x, np.zeros_like(x))
mlab.plot3d(x, 2 - 2*x, f(x, 2 - 2*x))

mlab.axes(utility)
######################################################################



-- 
Guilherme P. de Freitas
http://www.gpfreitas.com



More information about the SciPy-User mailing list