Python Seaborn 不显示所有数据

标签 python machine-learning seaborn

我想用seaborn进行测试以显示一些玩具数据。 python代码如下:

import numpy as np
from pandas import DataFrame
import seaborn as sns
from sklearn.datasets import make_classification

def test_seaborn():
    X, y = make_classification(n_samples=1000, 
                               n_features=20, 
                               n_informative=2,
                               n_redundant=2, 
                               n_classes=2, 
                               random_state=0)

    df = DataFrame(np.hstack((X, y[:, None])),
                   columns = range(20) + ["class"])

    sns.pairplot(df[:50], 
                 vars=[8, 11, 12, 14, 19], 
                 hue="class", 
                 size=1.5)

    sns.plt.show()

if __name__=='__main__':
    test_seaborn()

在一些指南中,情节应如下所示:(每个模块中显示近 50 个点) enter image description here 实际上,我得到了这样的情节(几点): enter image description here

顺便说一句,环境信息: 发行商 ID:Ubuntu 说明:Ubuntu 14.04.3 LTS numpy:1.10.4 scikit学习:0.17 Seaborn:0.7.0

你能帮我吗?谢谢!

最佳答案

您在 matplotlib 1.3 中遇到了错误。解决方案是升级您的 matplotlib。如果您不想这样做,则必须手动设置每行和每列的轴限制。

关于Python Seaborn 不显示所有数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35422753/

相关文章:

python - python 类中的范围令人惊讶的行为

machine-learning - BigQuery 拆分数据集偏差

python - 是否可以在 SqlAlchemy 中按名称连接到 docker db 容器?

python - 过滤字典的字典

R - 逻辑回归 - 模型预测和分割数据的情况非常糟糕。有想法吗?

python - 六边形联合图的 Seaborn 成对矩阵

python - 使 von Mises KDE 适应 Seaborn

python - 箱线图 : Outliers Labels Python

python - 连接两个数据帧并从索引创建多索引

java - 如何在 Java 中创建混淆矩阵