【问题标题】:Facing issue with seaborn.heatmap() [duplicate]面临 seaborn.heatmap() 的问题 [重复]
【发布时间】:2020-08-02 05:11:47
【问题描述】:

我正在使用 JupyterLab。当我从事数据可视化工作时,我遇到了seaborn.heatmap() 的问题。单元格不均匀,图中的值不可见。
这是代码 sn-p 和输出。

我正在使用由seaborn 库提供的提示数据集。
我什至在 IDLE 中尝试过,但遇到了同样的问题。

有没有办法解决这个问题。

【问题讨论】:

    标签: python-3.x seaborn jupyter-lab


    【解决方案1】:

    可能是与您使用的 ma​​tplotlib 版本有关的问题。看看这个答案: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))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-17
      • 2020-07-09
      • 1970-01-01
      相关资源
      最近更新 更多