Python seaborn pairplot
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib
%matplotlib inline
- 导入数据(数据瞎编的)
建议表格中不参与画图的内容用不要用数字,有类似等级或分组的情况,可用英语分类,如’A’,‘B’,‘C’,‘D’
test_dict = {'name':['Alice','Bob','Cindy','Eric','Helen','Grace '],
'math':[90,89,99,78,97,93],
'english':[89,94,80,94,94,90],
'chinese':[85,86,68,56,88,64],
'physics':[90,86,99,56,88,90],
'chemistry':[77,66,97,87,90,80],
'sum':['B','B','A','C','A','B']
}
test_dict_df = pd.DataFrame(test_dict)
test_dict_df.head()
sns_plot = sns.pairplot(test_dict_df,
vars = ['math','english','chinese','physics','chemistry'],
hue = 'sum',
diag_kind = 'kde', plot_kws = {'alpha': 0.6, 's': 80, 'edgecolor': 'k'}
);
sns_plot.savefig("cor_plot",dpi=400)
其他功能/参数可 ?function 查询
?sns.pairplot