2.1.7.5.Grids

0. Grids的繪圖種類

  • sns.PairGrid

  • sns.FacetGrid

1. 使用library

import seaborn as sns
  • 將圖表直接嵌入到Notebook之中

%matplotlib inline
  • 讀入資料

tips = sns.load_dataset('tips')
tips.head()
iris=sns.load_dataset('iris')
iris.head()

2.PairGrid

import matplotlib.pyplot as plt
g = sns.PairGrid(iris)
g.map_diag(sns.distplot)
g.map_upper(plt.scatter)
g.map_lower(sns.kdeplot)

3.FacetGrid

g = sns.FacetGrid(data=tips, col='time',row='smoker')
g.map(sns.distplot,'total_bill')

Last updated

Was this helpful?