# Author:Nimo_Ding
'''
Seaborn数据集自带了car_crashes数据集,这是一个国外车祸的数据集。
1、请对这个数据集进行成对关系的探索
2、请用Seaborn画二元变量分布图,scatter、kde、hex
'''
import seaborn as sns
import matplotlib.pyplot as plt
import ssl
car_crashes=sns.load_dataset('car_crashes')
print(car_crashes.head(3))
# 成对关系
sns.pairplot(car_crashes)
plt.show()
# 二元变量分布
sns.jointplot(x="total",
y="alcohol",
data=car_crashes,
kind='scatter')
sns.jointplot(x="total",
y="alcohol",
data=car_crashes,
kind='kde')
sns.jointplot(x="total",
y="alcohol",
data=car_crashes,
kind='hex')
成对关系:
scatter:
kde:
hex: