等高线

from  matplotlib  import  pyplot
import  numpy

def  f(x,y):
    return  (1-x/2+x**5)*numpy.exp(-x**2-y**2)

n=256
x=numpy.linspace(-3,3,n)
y=numpy.linspace(-3,3,n)

x1,y1=numpy.meshgrid(x,y)

pyplot.contourf(x1,y1,f(x1,y1),8,alpha=0.7,cmap=pyplot.cm.cool)



a=pyplot.contour(x1,y1,f(x1,y1),20)

pyplot.clabel(a,inline=True,fontsize=10)


pyplot.xticks(())
pyplot.yticks(())
pyplot.show()

猜你喜欢

转载自www.cnblogs.com/luckiness/p/13170470.html