kdeplot(核密度估计图)

核密度估计(kernel density estimation)是在概率论中用来估计未知的密度函数,属于非参数检验方法之一。通过核密度估计图可以比较直观的看出数据样本本身的分布特征。具体用法如下:

x=np.random.randn(100)  #随机生成100个符合正态分布的数sns.kdeplot(x)
sns.kdeplot(x,shade=True)

 seaborn图形

 二元kde图像

y=np.random.randn(100)
sns.kdeplot(x,y,shade=True,,cbar=True)

 seaborn图形

distplot

displot()集合了matplotlib的hist()与核函数估计kdeplot的功能,增加了rugplot分布观测条显示与利用scipy库fit拟合参数分布的新颖用途。具体用法如下:

import matplotlib.pyplot as pltfig,axes=plt.subplots(1,3) #创建一个一行三列的画布
sns.distplot(x,ax=axes[0]) #左图
sns.distplot(x,hist=False,ax=axes[1]) #中图
sns.distplot(x,kde=False,ax=axes[2]) #右图

 seaborn图形

from scipy.stats import *
sns.distplot(x,hist=False,fit=norm) #拟合标准正态分布

seaborn图形

 热点图heatmap( )

 

f, ax = plt.subplots(figsize=(10, 7))
plt.xticks(rotation='90')
#还有一种蓝色的配色比较喜欢cmap='YlGnBu'
sns.heatmap(corrmat, square=True, linewidths=.5, annot=True)
plt.show()

 seaborn图形

pointplot

(其实可以理解为折线图若点上有直线那么代表着这个点的取值是估计的,直线越大代表着std越大)

sns.pointplot(x='MSSubClass',y='SalePrice',data=train)

 seaborn图形

pairplot( )

 

mport seaborn as sns  
import matplotlib.pyplot as plt  
iris = pd.read_csv('../input/iris.csv')  
sns.pairplot(iris, vars=["sepal width", "sepal length"],hue='class',palette="husl")    
plt.show()  

 

 seaborn图形

 

相关文章:

  • 2021-09-13
  • 2021-08-31
  • 2022-12-23
  • 2022-01-16
  • 2021-07-04
  • 2022-12-23
  • 2021-06-14
  • 2022-02-14
猜你喜欢
  • 2021-12-30
  • 2021-12-05
  • 2022-12-23
  • 2021-11-10
  • 2021-07-09
相关资源
相似解决方案