import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
def process_signals(x,y):
return (1-(x**2+y**2))*np.exp(-y**3/3)
x = np.linspace(-5,5,100)
y = np.linspace(-5,5,100)
X,Y = np.meshgrid(x,y)
Z = process_signals(X,Y)
N = np.arange(-5,2,0.5)
fig = plt.figure(1,(18,6))
fig.add_subplot(121)
CS = plt.contour(Z,N,linewidth=1,cmap='jet')
plt.clabel(CS,inline=True,fmt='%1.1f',fontsize=10)
plt.colorbar(CS)
fig.add_subplot(122)
CS = plt.contourf(Z,N,linewidth=1,cmap='jet')
plt.colorbar(CS)
plt.show()
Python:等高线图1
最新推荐文章于 2023-11-22 22:52:04 发布