写一段python代码绘制热力图
时间: 2023-03-09 19:02:59 浏览: 123
python绘制热力图heatmap
答案:import seaborn as sns
import matplotlib.pyplot as plt
data = [[ 0.8, 0.7, 0.7, 0.6, 0.6],
[ 0.7, 0.6, 0.6, 0.5, 0.5],
[ 0.6, 0.5, 0.5, 0.4, 0.4],
[ 0.5, 0.4, 0.4, 0.3, 0.3],
[ 0.4, 0.3, 0.3, 0.2, 0.2]]
sns.heatmap(data, cmap = 'Reds', annot = True)
plt.show()
阅读全文