我试图获取由imshow()
函数生成的matplotlib热力图上每个单元格的颜色,例如下面magic_function
所执行的操作:
import matplotlib.pyplot as plt
import numpy as np
hm = plt.imshow(np.random.rand(10, 10))
color_matrix = hm.magic_function() #returns matrix containing the RGB/Hex values of each cell