Seaborn

R ユーザーのための Python

Daniel Chen

Instructor

Seaborn

  • 棒グラフ: barplot
  • ヒストグラム: histplot
  • 箱ひげ図: boxplot
  • 散布図: regplot
  • Seabornの特徴
    • データによる色分け
    • データによるファセット表示
R ユーザーのための Python

Seabornのヒストグラム

import seaborn as sns
import matplotlib.pyplot as plt
sns.histplot(iris['sepal_length'], kde = True)
plt.show()

R ユーザーのための Python

Seabornのカウントプロット

sns.countplot('species', data=iris)
plt.show()

R ユーザーのための Python

Seabornの箱ひげ図

sns.boxplot(x='species', y='sepal_length', data=iris)
plt.show()

R ユーザーのための Python

Seabornの散布図

sns.regplot(x='sepal_length', y='sepal_width', data=iris)
plt.show() 

R ユーザーのための Python

Seaborn散布図(回帰直線なし)

sns.regplot(x='sepal_length', y='sepal_width', data=iris,
            fit_reg=False)
plt.show()

R ユーザーのための Python

Seabornのファセット

sns.lmplot(x='sepal_length', y='sepal_width', data=iris,
           fit_reg=False,
           col='species')
plt.show() 

R ユーザーのための Python

Seaborn FacetGrid

g = sns.FacetGrid(iris, col="species")
g = g.map(plt.hist, "sepal_length")
plt.show()

R ユーザーのための Python

練習しましょう!

R ユーザーのための Python

Preparing Video For Download...