【发布时间】:2019-01-03 15:50:23
【问题描述】:
我想在热图单元格上添加十字 (X)(取决于显着性水平,但问题在于添加 X)。
就像在 R 语言中一样 (sig.level = XXX)。
查看使用的 Python 和 R 代码以及相应的输出图像。
感谢您的帮助。
# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, center=0, vmin=-1, vmax=1, square=True, linewidths=0.5, fmt=".2f",
cbar_kws={"shrink": .65, "orientation": "horizontal", "ticks":np.arange(-1, 1+1, 0.2)},
annot = True, annot_kws={"weight": 'bold', "size":15})
corrplot(cor(subset (wqw, select =
c(fixed.acidity:quality,ratio.sulfur.dioxide))),
# compute the p matrix
p.mat = cor.mtest(subset
(wqw, select = c(fixed.acidity:quality,ratio.sulfur.dioxide))),
# significance level 0.01
sig.level = 0.01,
# Method to display : color (could be corcle, ...)
method = "color",
# color palette
col = colorRampPalette(c("#BB4444", "#EE9988",
"#FFFFFF", "#77AADD", "#4477AA"))(200),
)
```
【问题讨论】:
-
你能不能只是事后进入并手动为 abs(corr)
标签: python matplotlib seaborn heatmap