每当我创建一个混淆矩阵时,我发现单元格之间没有边界线。我想在所有单元格之间添加一条黑色的边界线。这可以实现吗?我正在使用Python、sklearn、mpl cursors和matplotlib。
回答:
使用linewidths参数
sns.heatmap(confusion_mat_df, annot=True,linewidths=2,cmap="Blues")
参见 https://seaborn.pydata.org/generated/seaborn.heatmap.html