[SciPy-user] Re: Contour plots
bryan.cole at teraview.com
Tue Jun 8 05:43:21 CDT 2004
On Mon, 07 Jun 2004 16:14:35 +0200, Nils Wagner wrote:
> Dear experts,
... doesn't apply to me.
> I want to compute
> f(x,y) = log(abs(det(A(x+1j*y))))
> over a grid of x,y.
> How can I contour the result within scipy or matplotlib ?
I struggled with this a while back. You can plot pixmaps from 2D array
data using either scipy.plt or matplotlib, but I don't think you can get
contours. gplt (Gnuplot) can generate contours in 3D plots but I can't see
a way to get a contour plot on 2D axes. Gist can do contours but
scipy.xplt is unix-only and anyway, I couldn't get scipy.xplt to compile
on my FC2-linux machine, so havn't tried it myself.
There is a separate python interface to gist, PyGist
which works well. I've just been experimenting with it and it looks the
best out-the-box plotting solution for contours so far. PyGist is also
available for win32. The Gist command set is rather cryptic, however;
matplotlib is much easier for normal 2D graphs IMHO.
There's a PyGist example below.
from gist import *
window(0, wait=1, style='boxed2.gs')
ij = indices((20,20))/20.0 #make a grid
x = ij
y = ij
def f(x,y): #or the function of your choice...
return sin(x**2) + cos(y**2)
z = f(x,y)
plc(z, y, x) #makes contour plot
raw_input() #to stop python exiting
More information about the SciPy-user