(86)--Python数据分析:散布图

# 散布图必须通过两个数据序列才能绘制而成,也可以通过一个数据框绘制成散布矩阵。

 import pandas as pd

import numpy as np

import matplotlib.pyplot as plt
X1=np.arange(1,1002,1)

X2=np.random.normal(3,1,1001)

X3=np.random.randn(1001)

X4=np.random.rand(1001)

X5=np.random.beta(2,1,1001)


test_data=np.column_stack((np.column_stack((np.column_stack((np.column_stack((X1,X2)),X3)),X4)),X5))

test_frame=pd.DataFrame(test_data)

pd.scatter_matrix(test_frame,diagonal='kde',color='g',figsize=(10,10))

C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py:21: FutureWarning: pandas.scatter_matrix is deprecated. Use pandas.plotting.scatter_matrix instead
Out[1]: 
array([[,
        ,
        ,
        ,
        ],
       [,
        ,
        ,
        ,
        ],
       [,
        ,
        ,
        ,
        ],
       [,
        ,
        ,
        ,
        ],
       [,
        ,
        ,
        ,
        ]], dtype=object)

plt.show()



(86)--Python数据分析:散布图_第1张图片


散布矩阵数据索引图如下:

X1X1密度图

X2X1

X3X1

X4X1

X5X1

X1X2

X2X2密度图

X3X2

X4X2

X5X2

X1X3

X2X3

X3X3密度图

X4X3

X5X3

X1X4

X2X4

X3X4

X4X4密度图

X5X4

X1X5

X2X5

X3X5

X4X5

X5X5密度图

 

 

兄弟连学python


Python学习交流、资源共享群:563626388 QQ


你可能感兴趣的:(数据分析)