pandas绘制矩阵散点图(scatter_matrix)的方法

以 sklearn的iris样本为数据集

 

import matplotlib.pyplot as plt
from scipy import sparse
import numpy as np
import matplotlib as mt
import pandas as pd
from IPython.display import display
from sklearn.datasets import load_iris
import sklearn as sk
from sklearn.model_selection import  train_test_split

iris=load_iris()
#print(iris)
X_train,X_test,y_train,y_test = train_test_split(iris['data'],iris['target'],random_state=0)
iris_dataframe = pd.DataFrame(X_train,columns=iris.feature_names)
grr = pd.plotting.scatter_matrix(iris_dataframe,c=y_train,figsize=(15,15),marker='o',hist_kwds={'bins':20},s=60,alpha=.8)
plt.show()

posted @ 2019-10-14 16:46  昕友软件开发  阅读(5905)  评论(0编辑  收藏  举报
欢迎访问我的开源项目:xyIM企业即时通讯