python - matplotlib/seaborn : first and last row c

当使用 seaborn 绘制热图(以及使用 matplotlib 绘制相关矩阵)时,第一行和最后一行被减半。 当我运行我在网上找到的这个最小代码示例时,也会发生这种情况。

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

data = pd.read_csv('https://raw.githubusercontent.com/resbaz/r-novice-gapminder-files/master/data/gapminder-FiveYearData.csv')
plt.figure(figsize=(10,5))
sns.heatmap(data.corr())
plt.show()

y 轴上的标签位于正确的位置,但行不完整。

几天前,它按预期工作。从那以后,我安装了 texlive-xetex,所以我再次将其删除,但它并没有解决我的问题。

有什么我可能遗漏的想法吗?

最佳答案

不幸的是 ma​​tplotlib 3.1.1 broke seaborn heatmaps ;并且通常带有固定刻度的倒轴。
这在当前的开发版本中已修复;你可能因此

  • 恢复到 matplotlib 3.1.0
  • 使用 matplotlib 3.1.2 或更高版本
  • 手动设置热图限制(ax.set_ylim(bottom, top) # set the ylim to bottom, top)

关于python - matplotlib/seaborn : first and last row cut in half of heatmap plot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57445359/

相关文章:

reactjs - Heroku:使用不同的环境变量提升静态 react 页面

angular - 从 7.2.15 : minTimeout is greater than ma

r - 如何确定简单回文 R 代码的时间复杂度?

spring-boot - Spring boot 2.1.6 上的 spring.metrics.

c# - 如何使用 sendgrid 在列表中添加联系人?

azure - Cosmos DB 左连接

google-chrome - 引用错误 : expect is not defined

vue.js - Vue - 多个可选的路由器参数

css - Angular2 查询生成器模块删除按钮布局

reactjs - 如何使用历史更新 react 路由器的分页栏?