2
Hello, I’m having some problems with pylab’s Contour() function. In the final image, the values of the x and y axis are ranging from 0 to 600, which was the number of intervals in my arange(). However, I wanted x and y values (-3 to 3)
from numpy import exp,arange
from pylab import meshgrid,cm,imshow,contour,clabel,colorbar,axis,title,show
q=3
def z_func(x,y):
return exp(-((x**2)+((y/q)**2))/2)
x = arange(-3.0,3.0, 0.01)
y = arange(-3.0,3.0, 0.01)
X,Y = meshgrid(x, y)
Z = z_func(X, Y)
im = imshow(Z)
cset = contour(Z,linewidths=2)
clabel(cset,inline=True,fmt='%1.1f',fontsize=10)
colorbar(im)
title('$z = e^{-(x^2+(y/q)^2)/2}$')
show()
I tried to put Contour(X, Y, Z), but the situation just got worse... It’s probably some small detail, sorry if the question is too silly, but I’ve tried everything.