seaborn圖形

kdeplot(核密度估計圖)

核密度估計(kernel density estimation)是在機率論中用來估計未知的密度函數,屬於非參數檢驗方法之一。經過核密度估計圖能夠比較直觀的看出數據樣本自己的分佈特徵。具體用法以下:python

x=np.random.randn(100)  #隨機生成100個符合正態分佈的數sns.kdeplot(x)
sns.kdeplot(x,shade=True)

 

 二元kde圖像app

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

 

distplot

displot()集合了matplotlib的hist()與核函數估計kdeplot的功能,增長了rugplot分佈觀測條顯示與利用scipy庫fit擬合參數分佈的新穎用途。具體用法以下:dom

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]) #右圖

 

from scipy.stats import *
sns.distplot(x,hist=False,fit=norm) #擬合標準正態分佈

 熱點圖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()

 

pointplot

(其實能夠理解爲折線圖若點上有直線那麼表明着這個點的取值是估計的,直線越大表明着std越大)函數

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

 

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()  

 

 

相關文章
相關標籤/搜索