小编Joe*_*Joe的帖子

在背景图片上绘制Seaborn热图

我正在通过Jupyter中的seaborn创建一个热图,以显示将选择某个坐标点的人数。我目前使用以下代码创建了热图

cm = metrics.confusion_matrix(yVals, xVals)
fig, ax = plt.subplots(figsize=(10,10))
sns.heatmap(cm, annot=True, fmt="0.3f", linewidth=0.5, cbar=False,
              cmap="Reds", square=True, ax=ax)
plt.show()
Run Code Online (Sandbox Code Playgroud)

如果需要查看图片的外观,也可以使用此图片的链接。我的问题是,如何将这个热图绘制在背景图像的上方,并使热图中的正方形越接近0,则它们越能显示背景图像,从而使其更加透明?还有一种方法可以将热图上的索引从1而不是0开始?

先感谢您!

python matplotlib seaborn jupyter

6
推荐指数
2
解决办法
4031
查看次数

标签 统计

jupyter ×1

matplotlib ×1

python ×1

seaborn ×1