類別型圖表

Seaborn 資料視覺化中級

Chris Moffitt

Instructor

類別型資料

  • 取值有限且固定的資料
  • 通常與數值資料一起使用
  • 例子:
    • 地理(國家、省州、區域)
    • 性別
    • 族裔
    • 血型
    • 眼睛顏色
Seaborn 資料視覺化中級

圖表類型-逐筆觀測

每筆觀測的類別圖

Seaborn 資料視覺化中級

圖表類型-抽象表徵

抽象化的類別圖

Seaborn 資料視覺化中級

圖表類型-統計估計

統計型的類別圖

Seaborn 資料視覺化中級

逐筆觀測圖-stripplot

sns.stripplot(data=df, y="DRG Definition",
              x="Average Covered Charges",
              jitter=True)

stripplot 範例

Seaborn 資料視覺化中級

逐筆觀測圖-swarmplot

sns.swarmplot(data=df, y="DRG Definition",
              x="Average Covered Charges")

swarmplot 範例

Seaborn 資料視覺化中級

抽象表徵-boxplot

sns.boxplot(data=df, y="DRG Definition",
            x="Average Covered Charges")

boxplot 範例

Seaborn 資料視覺化中級

抽象表徵-violinplot

sns.violinplot(data=df, y="DRG Definition",
               x="Average Covered Charges")

violinplot 範例

Seaborn 資料視覺化中級

抽象表徵-boxenplot

sns.boxenplot(data=df, y="DRG Definition",
              x="Average Covered Charges")

boxenplot 範例

Seaborn 資料視覺化中級

統計估計-barplot

sns.barplot(data=df, y="DRG Definition", 
            x="Average Covered Charges",
            hue="Region")

barplot 範例

Seaborn 資料視覺化中級

統計估計-pointplot

sns.pointplot(data=df, y="DRG Definition", 
              x="Average Covered Charges",
              hue="Region")

pointplot 範例

Seaborn 資料視覺化中級

統計估計-countplot

sns.countplot(data=df, y="DRG_Code", hue="Region")

countplot 範例

Seaborn 資料視覺化中級

一起來練習吧!

Seaborn 資料視覺化中級

Preparing Video For Download...