開始使用免費開始

繪製直方圖

displot() 函式預設會回傳直方圖。 displot() 也能建立 KDE 或 rug 圖,這些都是檢視資料的實用方式。 Seaborn 也可以把這些圖形結合起來,幫助你做出更有意義的分析。

本練習屬於課程

Seaborn 資料視覺化中級

檢視課程

練習說明

  • 為資料建立一個 displot
  • 在直方圖中,明確傳入數值 20 作為區間(bins)的數量。
  • 使用 plt.show() 顯示圖表。

動手互動練習

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

# Create a displot
sns.displot(df['Award_Amount'],
             bins=____)

# Display the plot
plt.show()
編輯並執行程式碼