python-3.x - 面临 seaborn.heatmap() 的问题
问题描述
我正在使用 JupyterLab。当我从事数据可视化工作时,我遇到了seaborn.heatmap()
. 单元格不均匀,图中的值不可见。
这是代码片段和输出。
我正在使用图书馆提供的提示数据集。
我什至在 IDLE 中尝试过,但遇到了同样的问题。 seaborn
有没有办法解决这个问题。
解决方案
也许这是与您正在使用的matplotlib版本相关的问题。看看这个答案:matplotlib/seaborn: first and last row cut in half of heatmap plot
但是您可以尝试手动设置轴:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
tips = sns.load_dataset('tips')
g=sns.heatmap(tips.corr(), annot= True)
g.set(ylim=(0,3))
g.set(xlim=(0,3))
我能够通过以下方式重现设置轴的“错误”:
g.set(ylim=(0.5,2.5))
g.set(xlim=(0,3))
推荐阅读
- ios - 在 nginx 配置上为 apple-app-site-association 文件设置内容类型
- php - 编辑已添加的文档
- pandas - 无法在没有硬编码的情况下将值插入数据集中
- php - 在 laravel 中允许无效日期
- javascript - 重定向到其他页面给我 500 内部服务器错误反应
- javascript - 使用 Javascript 计算和显示页面权重
- r - 总结以在 data.table r 中获取 group by 的平均值和第一个值
- javascript - vuelidate 插件中的自定义验证
- spring-security - 用于 SSO 实施的 OpenAm 与 Spring Security
- python - 根据条件计算列平均值 pandas