matplotlib 的單變量與雙變量圖
Matplotlib 是 Pandas 和 Seaborn 中所有繪圖功能的核心。 了解 matplotlib 的運作方式,能幫你為發表或報告微調圖表。
在這個練習中,你將建立直方圖與散佈圖:
# Histogram
plt.hist(df['column_name'])
plt.show()
# Scatter plot
plt.scatter(df['x_column'], df['y_column'])
plt.show()
記得必須呼叫 plt.show() 才會顯示圖表。本練習會使用已預先載入的資料集 tips。
本練習屬於課程
給 R 使用者的 Python
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
import matplotlib.pyplot as plt
# Univariate histogram
plt____
____