Re: [MayaVi-users] Setting the aspect ratio (x/y/z) of a surface plot?
Status: Beta
Brought to you by:
prabhu_r
|
From: Fernando P. <fp...@pi...> - 2003-02-20 21:13:08
|
On Fri, 21 Feb 2003, Prabhu Ramachandran wrote: > Well, I think I've got the scale working for view but I am a little > confused about surf. Lets say you do this: > > x = Numeric.arange(-5., 5.05, 0.05) > y = Numeric.arange(-5., 5.05, 0.05) > v = surf(x, y, f, scale=[2, 1, 2]) > > Now, what is that supposed to mean? Sample the values at x*2, y*1 and > scale the z values by 2? Or sample it at x, y and z and lie to me > about the length of x? The trouble with surf is that you have f(x, y) > that is sampled regularly somewhere and when MayaVi plots something > scaled up the axes will show you the actual scaled values (and not the > unscaled ones). This could lead to misleading results. OTOH if its > an array and you specifically want it scaled, you asked for it and > better know what you are doing but I find it uncomfortable. Any > suggestions? Well, I am thinking of the scaling operations as being strictly visual ones, which do _not_ have any impact on the data ranges themselves. I don't know if this is possible or not. So that the values displayed on the axes would still be the true values for x/y/z, but simply their visual size would change. In this case, a call with scale=(2,1,2) would mean 'stretch the x and z directions by a factor of two, leave y unchanged'. So if for example the ranges of the data in x and z were [0,0.5] while the y range was [0,1], the above call would produce a cube. _But_, the labels on the axes would still show that the largest x/z was 0.5. That way we can get whatever is a convenient visual representation, while still having the axis marks indicate the actual data range. Imagine you are plotting say a capacitance distribution in pF over a square plate 1cm in side. You have many orders of magnitude difference there, but if you can just _visually_ rescale the z data by the appropriate factor, you could see a nice surface plot with the right proportions. But don't worry too much. If this is actually complex to implement internally, just let users rescale their own data by hand and be done with it. The tool is already very useful as it is. > Well, it will not be hard to add a simple viewAsImage() that lets you > view a large array as an image (black and white initially). You can > always interact with it as in you can zoom in and out etc., save the > scene to an image but thats about it. Will this be useful? If it > will be I'll try and add this during the weekend. If this is only a > waste of time I'd rather not do it though. :) That might be worth having. If nothing else, because it allows you not to worry about shifting environments altogether from mayavi to something else at some arbitrary size threshold (memory-dependent). And then maybe in the future colormap support can be added :) Cheers, f. |