import numpy as np
import matplotlib.pyplot as plt
data = np.array([791643, 63, 1250, 84, 96, 44, 52, 552, 84, 146,
64, 1053254, 53, 146, 107, 43, 46, 97, 103, 64,
1212, 56, 790742, 100, 70, 96, 61, 1070, 115, 303,
86, 136, 91, 1150511, 1212, 79, 44, 178, 95, 103,
93, 117, 87, 1285, 1259635, 86, 48, 66, 353, 71,
44, 51, 77, 97, 98, 1087581, 38, 60, 463, 43,
66, 39, 54, 44, 51, 35, 590175, 85, 55, 77,
522, 86, 945, 173, 59, 49, 71, 876629, 204, 154,
81, 118, 90, 94, 375, 461, 41, 172, 1231624, 80,
155, 77, 282, 100, 66, 41, 83, 189, 81, 1033678]).reshape(10, 10)
plt.figure(figsize=(12, 9))
heatmap = plt.imshow(data, cmap='Blues')
for i in range(len(data)):
for j in range(len(data[0])):
plt.text(j, i, str(data[i, j]), ha='center', va='center', fontsize=10, color='red')
plt.colorbar(heatmap)
x_labels = ['D01','D02','D03','D04','D05','D06','D07','D08','D09','D10']
y_labels = ['D01','D02','D03','D04','D05','D06','D07','D08','D09','D10']
plt.xticks(np.arange(len(x_labels)), x_labels, rotation=45)
plt.yticks(np.arange(len(y_labels)), y_labels)
plt.savefig('new_heatmap.png', dpi = 2400)
效果展示