タイトルとラベルの追加:パート1

Seabornで学ぶデータ可視化入門

Content Team

DataCamp

情報量のある可視化を作る

地域別の出生率の箱ひげ図

タイトルとラベル付きの地域別出生率の箱ひげ図

Seabornで学ぶデータ可視化入門

FacetGrid と AxesSubplot オブジェクト

Seaborn のプロットは 2 種類のオブジェクトを作成します: FacetGridAxesSubplot

g = sns.scatterplot(x="height", y="weight", data=df)

type(g)
> matplotlib.axes._subplots.AxesSubplot
Seabornで学ぶデータ可視化入門

空の FacetGrid

空の 4x4 の FacetGrid

Seabornで学ぶデータ可視化入門

FacetGrid と AxesSubplot オブジェクト

Object Type Plot Types Characteristics
FacetGrid relplot(), catplot() 複数サブプロットを作成
AxesSubplot scatterplot(), countplot() など 単一プロットのみ作成
Seabornで学ぶデータ可視化入門

FacetGrid にタイトルを追加

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")

g.figure.suptitle("New Title")
plt.show()

タイトルを追加した出生率の箱ひげ図

Seabornで学ぶデータ可視化入門

FacetGrid のタイトル位置を調整

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")

g.figure.suptitle("New Title", 
               y=1.03)

plt.show()

高めに配置したタイトル付き出生率プロット

Seabornで学ぶデータ可視化入門

Let's practice!

Seabornで学ぶデータ可視化入門

Preparing Video For Download...