I thought it was cool the first time I saw it.
Just try something simple

from pylab import *
x,y = meshgrid(linspace(-5,5,101),linspace(0,5,101))
h = y
z = x + complex(0,1)*y
znew = z**0.25  # Doing a simple conformal map
xnew = znew.real
ynew = znew.imag

And you get nice contours in a pieslice-shaped domain with an angle of 45 degrees


From: "Scott Sinclair" <sinclaird@ukzn.ac.za >

That is very cool, I hadn't thought of it!

So what you're saying is that any transformation (a complex distortion) of a regular rectangular grid is fine. The fact that the grid's 'pixels' are four sided quadrilaterals satisfies this condition and the contour algorithm works...


>>> "Mark Bakker" <markbak@gmail.com> 7/11/2007 11:36 >>>
Viraj and Jeff -

Maybe one extension of Jeff's answer.
The process works as long as x, y, and z are 2D arrays of the same size and shape.
Hence, x and y don't have to form a rectangular grid.
I have used this feature regularly for conformal mapping.
And it makes a lot of sense.
The contour routine simply looks for intersections between x and y values.
Then when it plots it uses the x and y values in the arrays.
So when those are not a rectangular grid, it doesn't care.
It's a cool feature.
I can give an example if you want,