Тепловая карта с текстом в каждой ячейке с pyplot matplotlib
я используюmatplotlib.pyplot.pcolor () построить тепловую карту с помощью matplotlib:
import numpy as np
import matplotlib.pyplot as plt
def heatmap(data, title, xlabel, ylabel):
plt.figure()
plt.title(title)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
c = plt.pcolor(data, edgecolors='k', linewidths=4, cmap='RdBu', vmin=0.0, vmax=1.0)
plt.colorbar(c)
def main():
title = "ROC's AUC"
xlabel= "Timeshift"
ylabel="Scales"
data = np.random.rand(8,12)
heatmap(data, title, xlabel, ylabel)
plt.show()
if __name__ == "__main__":
main()
Есть ли способ добавить соответствующее значение в каждую ячейку, например:
(из Matlab'sНастраиваемые тепловые карты)
(Мне не нужно дополнительное%
для моего текущего приложения, хотя мне было бы интересно узнать в будущем)