# import matplotlib.pyplot as plt
# import numpy as np
# def f(x, y):
# return (1 - y**5 + x**5) * np.exp(-x**2 - y**2)
# dx = 0.01;dy=0.01
# x = np.arange(-2.0, 2.0, dx)
# y = np.arange(-2.0, 2.0, dy)
# X, Y = np.meshgrid(x, y)
# plt.title("geek-docs.com", fontsize=20, fontname="Times New Roman")
# C = plt.contour(X, Y, f(X,Y), 8, colors='black')
# plt.contourf(X, Y, f(X, Y), 8)
# plt.clabel(C, inline=1, fontsize=10)
# plt.show()
import matplotlib.pyplot as plt
import numpy as np
def f(x, y):
return (1 - y**5 + x**5) * np.exp(-x**2 - y**2)
dx = 0.01;dy=0.01
x = np.arange(-2.0, 2.0, dx)
y = np.arange(-2.0, 2.0, dy)
X, Y = np.meshgrid(x, y)
plt.title("geek-docs.com", fontsize=20, fontname="Times New Roman")
C = plt.contour(X, Y, f(X,Y), 8, colors='black')
plt.contourf(X, Y, f(X, Y), 8, cmap=plt.cm.hot)
plt.clabel(C, inline=1, fontsize=10)
plt.colorbar()
plt.show()
等直线图