調整刻度
在這個練習中,我們會繼續使用一份關於年輕人的問卷資料集。回報「覺得孤單」的人數百分比,會不會因為兄弟姊妹的數量而不同?讓我們用長條圖來找出答案,同時也認識 Seaborn 提供的四種不同繪圖刻度(「context」)。
我們已經將 Seaborn 以 sns,matplotlib.pyplot 以 plt 匯入。
本練習屬於課程
Seaborn 資料視覺化入門
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Set the context to "paper"
# Create bar plot
sns.catplot(x="Number of Siblings", y="Feels Lonely",
data=survey_data, kind="bar")
# Show plot
plt.show()