我对关联的热图有点麻烦。它没有显示我感兴趣的所有专栏。在
这是我的代码:
sns.set(style="white")
# Compute the correlation matrix
corr = data.corr()
# Generate a mask for the upper triangle
mask = np.zeros_like(corr, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True
# Set up the matplotlib figure
f, ax = plt.subplots(figsize=(11, 9))
# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 10, as_cmap=True)
# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, vmax=1, vmin=-1, center=0,
square=True, linewidths=1, cbar_kws={"shrink": .5})
代码基于:https://seaborn.pydata.org/examples/many_pairwise_correlations.html
这里有一小段数据列丢失了
问题是,正如你所见,我错过了CIVIST,F,L 我想不出办法解决它。在
谨致问候 基督徒
试着增加绘图的大小。 它对我有用
不确定这是否有帮助,但请确保确实计算了所需列的相关性。例如:
相关问题 更多 >
编程相关推荐