import numpy as np import matplotlib.pyplot as mp # 整理数据 n = 500 x, y = np.meshgrid(np.linspace(-3, 3, n), np.linspace(-3, 3, n)) # print(x) z = (1 - x / 2 + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) mp.figure('Imshow', facecolor='lightgray') mp.title('Imshow') mp.grid(linestyle=":") mp.imshow(z, cmap='jet', origin='low') mp.colorbar() mp.show()
来源:https://www.cnblogs.com/yuxiangyang/p/11326386.html