seaborn常用的10种数据分析图
散点图¶
In [6]:
# 小费数据集
tips = sns.load_dataset('tips')
ax = sns.scatterplot(x = 'total_bill', y = 'tip', data = tips)
plt.show()
In [9]:
ax = sns.barplot(x = 'day', y = 'total_bill', data = tips)
plt.show()
折线图¶
In [22]:
tips = sns.load_dataset("tips")
ax = sns.lineplot(x = 'day', y = 'total_bill', data = tips)
plt.show()
箱线图¶
In [24]:
sns.boxplot(x = 'day', y = 'total_bill', data = tips)
plt.show()
直方图¶
In [25]:
import numpy as np
np.random.seed(0)
x = np.random.randn(1000)
ax = sns.distplot(x)
plt.show()
热力图¶
In [26]:
np.random.seed(1)
uniform_data = np.random.rand(10,12)
ax = sns.heatmap(uniform_data)
plt.show()
散点图矩阵¶
In [27]:
iris = sns.load_dataset('iris')
ax = sns.pairplot(iris)
plt.show()
分类散点图¶
In [30]:
sns.catplot(x = 'day', y = 'total_bill', data = tips)
plt.show()
计数条形图¶
In [31]:
sns.countplot(x = 'day', data = tips)
plt.show()
回归图¶
In [32]:
sns.lmplot(x = 'total_bill', y = 'tip', data = tips)
plt.show()
In [ ]:
In [ ]:
浙公网安备 33010602011771号