我想用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
BTW,环境信息: 分销商ID:Ubuntu 说明:Ubuntu 14.04.3 LTS numpy:1.10.4 scikit学习:0.17 seaborn:0.7.0
你可以帮帮我吗?谢谢!答案 0 :(得分:1)
您在matplotlib 1.3中遇到过错误。解决方案是升级matplotlib。如果您不想这样做,则必须手动设置每行和每列的轴限制。