matplotlib之热成像图

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()

posted @ 2019-08-09 12:00  一如年少模样  阅读(1668)  评论(0编辑  收藏  举报