如何在这张图的基础上,做出每一对图片(左边两个是一组,右上两个一组,右下两个一组)各自的1-9分区区域的鼠标点击次数的热区图,用热区图形式来描述各个区域发生损伤的次数。

import random
from matplotlib import pyplot as plt

# 定义热图的横纵坐标
xLabel = ['A', 'B', 'C']
yLabel = ['1', '2', '3']

# 利用random生成伪数据(5*5)
data = []
for i in range(3):
   temp = []
   for j in range(3):
      k = random.randint(0, 100)
      temp.append(k)
   data.append(temp)

fig = plt.figure()
ax = fig.add_subplot(111)

ax.set_yticks(range(len(yLabel)))
ax.set_yticklabels(yLabel)
ax.set_xticks(range(len(xLabel)))
ax.set_xticklabels(xLabel)

im = ax.imshow(data, cmap=plt.cm.hot_r)

plt.colorbar(im)

plt.title("test")

plt.show()


这种图?


类似这种

撒打算的

作一个能反应损伤程度的热图


没人会就关闭了