開始使用免費開始

seaborn 中的一變量繪圖

Seaborn 是一個常用的繪圖函式庫。 它採用「tidy data」的概念,能讓你快速繪製多個變數的圖表。

你將先從產生一變量(univariate)圖開始。 長條圖與直方圖分別可使用 countplot()histplot() 函式建立。

import seaborn as sns
import matplotlib.pyplot as plt

# Bar plot
sns.countplot(x='column_name', data=df)
plt.show()

# Histogram
sns.histplot(df['column_name'], kde = True)
plt.show()

本練習屬於課程

給 R 使用者的 Python

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

import seaborn as sns
import matplotlib.pyplot as plt

# Bar plot
sns.____(x=____, data=tips)
plt.show()
編輯並執行程式碼