python - Jupiter Python seaborn 热图未显示所有相关性

标签 python heatmap seaborn correlation

我的相关性热图有一些问题。它没有显示我感兴趣的所有列。

这是我的代码:

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

Part of the result

这是丢失的数据列的片段

Snip of the columns missing

如您所见,问题是我缺少 CIVIST_D、F、L
我无法解决它。

亲切的问候
基督教

最佳答案

尝试增加绘图的大小。
它对我有用

corr=df.corr()
plt.subplots(figsize=(20,15))
sns.heatmap(corr)

关于python - Jupiter Python seaborn 热图未显示所有相关性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49896067/

相关文章:

python - 在Heroku上的python worker进程中使用try语句来处理由于对等错误而导致的连接重置是否理想?

python - 在 WSL Ubuntu 中绘制图形的反复出现的问题

javascript - 如何使用 Google Maps API 动态填充 heatMapData 数组并加载热图图层?

Python/Seaborn : What does the inside horizontal distribution of the data-points means or is it random?

python - Seaborn 热图 : Customize A Label

python - 如何用点而不是条形图创建直方图

python - 使用自定义函数时,Pandas apply/map 在某些行不起作用

r - 使用R获取热图中垃圾箱的数量

r - 热图中 x 轴上的对角线标签方向

python - 单元格边界 Gtk Treeview Python