Re: [MayaVi-users] Setting the aspect ratio (x/y/z) of a surface plot?
Status: Beta
Brought to you by:
prabhu_r
|
From: Prabhu R. <pr...@ae...> - 2003-02-19 18:46:29
|
>>>>> "FP" == Fernando Perez <fp...@pi...> writes:
[snipped PR's rant]
FP> No problem. I understand full well your position, and I agree
FP> that the redesign is a far more important priority. I just
FP> finished answering in essentially the same terms to a request
FP> for some windows-related work for IPython. So I can feel your
FP> pain :)
:-)
FP> But one micro-request. Since you said it was easy, could you
FP> add to view() in mayamat/tools (whichever name you choose) at
FP> least a scale option which just takes a 3-tuple of arguments
FP> and passes them accordingly? I'm asking only because you did
FP> say it would be easy for you to include it. And even if it
FP> requires a bit of manual work from users, it would be 90% of
FP> ideal in my book, and definitely far enough for any real work.
FP> I can always try out one or two values of the scaling tuple
FP> until I find something that looks good. So no 'auto' option,
FP> just a plain optional tuple (defaulting to (1,1,1)) which the
FP> user can pass to rescale each axis without having to know
FP> about the vtk pipeline's details.
Silly me. I forgot. Last night after reading your mail I added a 2d
scale for view() which defaults to [1,1]. I forgot to mail it to you.
I've attached it below. Let me know if thats enough or you need the
third parameter or if you need the same thing for surf as well?
For those of you new to this mayamat code (i.e. the rest of you on
MayaVi-users), attached is a simple module that lets you visualize
surfaces of the form z = F(x, y) using MayaVi and also lets you
visualize 2d Numeric arrays. I plan to put this up for download on my
web page sometime but I thought I'd give you folks a sneak peek. The
code is well documented and has a simple example at the end. To see
what it can do, just run it like so:
$ python mayamat.py
The name of the module is still in the air so don't bet on your life
that the name of the module will always remain mayamat. :)
Note that the module was designed for interactive use so something
like this is typical usage:
from Numeric import *
import mayamat
def f(x, y):
return sin(x*y)/(x*y)
x = arange(-5., 5.05, 0.05)
y = arange(-5., 5.05, 0.05)
v = mayamat.surf(x, y, f)
And there you have your surface ready to be viewed. Read the code for
more details on the view function also.
Enjoy!
cheers,
prabhu
|